Text Line Sorter
Sort lines alphabetically, numerically or by length, with the collation details that decide the result.
Need this done properly for your business?
Radiatus delivers secure cloud, DevOps & compliance engineering.
Alphabetical is not one order
A plain sort compares character codes, which puts every uppercase letter before every lowercase one: Zebra sorts before apple. A case-insensitive sort produces what most people mean by alphabetical. A locale-aware sort goes further and handles accented characters the way the language expects — in Swedish ä sorts after z, in German it sorts with a. Three different correct answers for the same input.
Numbers sort as text unless you say otherwise
Sorting 1, 2, 10, 20 alphabetically gives 1, 10, 2, 20, because comparison proceeds character by character and "1" precedes "2". This is the single most common surprise. Natural sort treats digit runs as numbers, producing the expected order, and is what you want for filenames, version strings and anything with an embedded index.
Leading whitespace changes everything
A space sorts before every printable character, so an indented line jumps to the top. Lines copied from code or nested lists routinely carry indentation that makes the sort look broken. Trimming before comparing is usually intended, though it changes the output, so it should be a deliberate choice.
Stable sorting matters when keys tie
A stable sort preserves the original relative order of lines that compare equal. This becomes important when sorting by a secondary property such as length: sorting by length with a stable algorithm keeps alphabetical order within each length group, so two sequential sorts produce a sensible multi-key result. An unstable sort scrambles the ties and the technique fails.
Reverse is not always the mirror image
Reversing a sorted list and sorting in descending order give the same result only when no two lines are equal. With ties, reversing also reverses their relative order, which a descending sort does not. On deduplicated data the distinction never surfaces; on data with repeats it does.
Sorting is the setup for other operations
Duplicates become adjacent once sorted, which is why sort and uniq are paired in the shell — uniq only collapses neighbours. Sorted data also diffs far more usefully, since an unsorted list of the same items shows every line as changed. Sorting before comparing two exports is often the step that makes the comparison meaningful.
Frequently Asked Questions
Privacy & Security
All processing happens locally in your browser — your text is never uploaded.
How to Use
Paste your lines, pick a sort mode. Results update instantly.
Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.
Related Tools
Emoji Picker & Copier
TextBrowse, search, and copy emojis by category. Collect multiple emojis and copy them all at once. Recently used emojis saved locally.
Text to Speech Player
TextConvert text to natural speech using the Web Speech API. Adjustable voice, speed, pitch, and volume with playback controls.
Speech to Text Transcriber
TextTranscribe speech to text using your microphone. Supports multiple languages with continuous listening, copy, and download features.