Sort lines
- Runs on your device
- Nothing uploaded
- Free, no sign-up
Client-side only. Sort runs in this tab. Nothing is uploaded.
How to sort lines
- Paste your list, one item per line.
- Pick a sort: A to Z, Z to A, natural, or reverse the current order.
- Set the options: case sensitive, trim before compare, ignore empty lines, and remove duplicates after sort. Trim only affects how lines are compared. The lines you get back keep their original text.
- Read the result and the counts under it: original lines, output lines, and empty lines skipped.
- Copy the result or download it.
Worked example: natural sort for numbered files
Five file names, sorted two ways:
| A to Z | Natural |
|---|---|
| file1.txt | file1.txt |
| file10.txt | file2.txt |
| file2.txt | file3.txt |
| file20.txt | file10.txt |
| file3.txt | file20.txt |
A to Z compares one character at a time, so "10" comes before "2". Natural sort reads the digits as numbers, which is what people expect for files, versions, and chapter lists.
Worked example: cleaning a keyword list
Seven lines from two spreadsheets: running shoes, Trail Shoes, running shoes (with leading spaces), an empty line, trail shoes, hiking boots, and Running Shoes (with a trailing space).
Sort A to Z with trim on, empty lines ignored, duplicates removed, and case sensitive off. The result is 3 lines: hiking boots, running shoes, Trail Shoes. The counts read 7 original, 3 output, 1 empty skipped.
Turn case sensitive on and you get 5 lines, because "Running Shoes" and "running shoes" now count as different. For keyword lists, leave it off.
When to use it
- Tidying keyword, tag, or email lists before you paste them somewhere else.
- Ordering file names, versions, or numbered items.
- Quick work on a list where opening a spreadsheet is more effort than the job.
Common mistakes
- Trailing spaces creating fake duplicates. Keep trim on. Without it, "running shoes" and "running shoes " stay as two lines.
- Leaving case sensitive on. Only turn it on when case matters, such as code identifiers.
- Sorting numbers with A to Z. Use natural sort when lines contain numbers.
Other list tools
To remove duplicates but keep the original order, use the duplicate line checker. To see what changed between two versions of a list, paste both into text compare. To make case consistent before sorting, run the list through the case converter. For a count of words and lines, the word counter helps.
FAQ
What is the difference between natural and A to Z sort?
A to Z compares text one character at a time, so file10 comes before file2. Natural sort treats runs of digits as numbers, so file2 comes before file10.
How do I remove duplicate lines?
Tick remove duplicates after sort. With trim on and case sensitive off, lines that differ only by spaces or capital letters are treated as the same. The first one found is kept.
What happens to empty lines?
With ignore empty lines on, they are dropped and counted as skipped. Turn it off to keep them in the sorted result.
Is reverse the same as Z to A?
No. Z to A sorts the lines in descending order. Reverse keeps your order and flips it, so the last line becomes the first.
Can it handle a long list?
Yes. Sorting runs in your browser, so lists of many thousands of lines work. Very large pastes depend on your device's memory.