Sort Lines
Sort lines alphabetically, numerically, or by length.
How to use Sort Lines
What this tool does
The Sort Lines tool reorders the lines of any text block according to rules you choose. Paste a list, pick a sort mode — alphabetical, numerical, or by line length — and choose ascending or descending direction. A case-sensitive toggle controls whether uppercase and lowercase letters are treated the same, and a separate toggle removes blank lines from the result. The sorted output appears immediately as you adjust any setting. There is no submit button; the result is always current.
Why you might need it
Sorting a list by hand is impractical beyond a dozen items, and spreadsheet functions require the data to be inside a cell first. A text file full of words, email addresses, file names, or log entries cannot be sorted natively in a plain text editor. Common scenarios include: alphabetising a glossary or bibliography, reordering a requirements list by ID number, grouping CSS class names alphabetically before committing them to a shared file, sorting a word list by length to find the longest entries quickly, or producing a canonical order for a configuration key list so diffs are easier to read.
Numerical sort is especially useful for ordered lists where a strict text sort would put “10” before “2”. Length sort surfaces your shortest or longest entries at a glance, which is handy when checking that every item in a list fits within a character limit.
How to use it
- Paste your list — one item per line — into the input area, or click Load sample for a ready-made example.
- Select a sort mode: Alphabetical orders by character value, Numerical orders by the numeric value of each line, and By length orders from shortest to longest (or longest to shortest).
- Set the direction to Ascending (A → Z, small → large) or Descending (Z → A, large → small).
- Tick Case-sensitive if capitalisation should affect the order.
- Tick Remove blank lines to drop any empty lines before sorting.
- Copy the result with the Copy output button.
Common pitfalls
Alphabetical sort can surprise people when numbers are involved. The string “10” comes before “2” alphabetically because it starts with “1”, which sorts before “2”. Switch to Numerical mode whenever your list contains numbers and order by value is what you need. The tool marks non-numeric lines in numerical mode by moving them to the bottom rather than failing — this keeps partially numeric lists manageable.
Case-sensitive mode can produce unexpected groupings if your list mixes uppercase and lowercase freely. With case-sensitive on, all capital-letter lines sort before their lowercase counterparts, so you get a block of A–Z followed by a separate block of a–z rather than a single interleaved list. Turning case-sensitivity off blends them together.
Blank lines sort to the very top in ascending alphabetical and ascending-length modes because they are the shortest and alphabetically earliest possible line. If that is not what you want, tick Remove blank lines.
Tips and advanced use
Combine Sort Lines with Remove Duplicate Lines: paste a raw list, remove duplicates first, then paste the result here and sort alphabetically for a clean, canonical, non-repeating list in a few seconds. This workflow handles what would otherwise require a spreadsheet or a script.
Length sorting is a quick quality check for anything with a character limit. Sort descending and immediately see the longest lines at the top — useful for checking that every tweet, meta description, or product title fits its constraint before you publish.
For developers, sorting import statements or CSS property lists alphabetically makes reviews faster and merges cleaner. Paste the block, sort ascending, copy back. Because nothing leaves your browser, it is safe to paste real data including internal lists, customer IDs, or private configuration values.
Frequently asked questions
Is my text processed on a server?
What is the difference between alphabetical and numerical sorting?
Does it handle lines with mixed numbers and text?
How does case-sensitive sorting work?
What happens to blank lines?
Related tools
Remove Duplicate Lines
Delete duplicate lines from a list of text.
Line Break Tool
Add or remove line breaks from text.
Reverse Word Order
Reverse the order of words in a sentence.
Text Shuffler
Randomly shuffle the words in your text.
Find and Replace
Find and replace text, with optional regex support.
Word Counter
Count words, characters, and reading time in real time.