Sort Lines Online - Alphabetical, Numeric, Natural
Sort a List of Lines
Paste any list with one item per line and pick a sort order. The sorted result appears straight away, with a line count, a copy button and a .txt download. Remove blank lines and Trim whitespace are on by default, because pasted lists often carry empty lines and stray spaces that would otherwise sort to the top.
Sort Orders Explained
- A–Z and Z–A sort alphabetically using your browser's language rules, so case and accents do not split the list into groups.
- Natural treats numbers inside text as numbers. It is the order a person expects for file names like photo1, photo2, photo10.
- Numeric sorts by the first number on each line, which suits prices, scores, sizes and line items like "250 g flour".
- By length puts the shortest lines first. Lines of equal length keep their original order.
- Reverse order flips the list upside down without sorting it, which is handy for log files where the newest entry is at the bottom.
- Shuffle puts the lines in a random order.
Worked Example
Take this list of file names:
report10.pdf
report2.pdf
Report1.pdf
report2.pdf
notes.txt A–Z gives notes.txt, Report1.pdf, report10.pdf, report2.pdf, report2.pdf. The blank line is gone and Report1 sits with the other reports despite the capital R, but report10 still comes before report2.
Natural gives notes.txt, Report1.pdf, report2.pdf, report2.pdf, report10.pdf, which is the order most people want.
Natural with Remove duplicates on gives notes.txt, Report1.pdf, report2.pdf, report10.pdf.
Numeric gives Report1.pdf, report2.pdf, report2.pdf, report10.pdf, notes.txt. notes.txt has no number, so it goes last.
Common Uses
Sorted lists are easier to scan and to compare. Sorting
.gitignore entries, dependency lists or environment
variable names keeps diffs small, because new entries land in a
predictable place. Shuffle is handy for picking a presentation order
or a random sample. On the command line, sort does A–Z
(byte order unless your locale says otherwise), sort -V is
close to Natural, sort -n to Numeric, and
shuf shuffles.
Tips
If your items are separated by commas rather than line breaks, use the List Deduplicator with Split on set to Comma, which can also sort. To see what changed between two versions of a list, use List Diff. To wrap each sorted line in quotes or add a trailing comma, pass the result through Add Prefix and Suffix. Everything runs locally in your browser, so nothing you paste is sent to a server.
Related Tools
Markdown Preview
Write Markdown and see the rendered HTML output in real time.
Lorem Ipsum Generator
Generate placeholder text in paragraphs, sentences, or words.
List Deduplicator
Remove duplicate lines from a list with options for case sensitivity and sort order.
List Diff / Compare
Compare two lists and find items unique to each, shared between both, or missing from one.