Sort Lines Online
Sort lines of text alphabetically, by length, reverse, or shuffle — free, instant, and right in your browser.
Input Text
Sorted Output
What Is a Line Sorter?
A line sorter takes a block of text and reorders its lines based on a rule you choose. It's one of those tools you reach for surprisingly often — sorting a list of names, cleaning up a config file, deduplicating entries, or just quickly checking if something is already in order. The classic approach uses JavaScript's Array.sort() with localeCompare for proper Unicode-aware alphabetical ordering — so accented characters and non-ASCII text sort correctly. For randomization, this tool uses a Fisher-Yates shuffle, which gives a statistically fair random order every time.
How to Use
Paste or type your text
Drop your lines into the left panel. Each line becomes a sortable item. You can also click "Upload" to load a plain text file.
Choose a sort option
Click A→Z, Z→A, Length↑, Length↓, Reverse, or Shuffle. The sorted result appears instantly in the right panel.
Copy or download
Hit "Copy" to grab the result to your clipboard, or "Download" to save it as a .txt file.
Example
Here's a quick example. Paste five city names on the left, click A→Z, and the right panel shows them sorted alphabetically.
Sorting city names A → Z
Tokyo
Berlin
Sydney
Amsterdam
Chicago→ A → Z
Amsterdam
Berlin
Chicago
Sydney
TokyoFAQ
Is the sort case-sensitive?
No. All sort modes (A→Z, Z→A, and length) treat uppercase and lowercase the same way. "apple" and "Apple" will sort together, not to opposite ends of the list. Under the hood this uses localeCompare with sensitivity: 'base'.
What does "Ignore blank lines" do exactly?
When checked, any empty or whitespace-only lines are removed from the output before sorting. This is handy when you paste text that has stray blank lines between entries and you just want a clean, sorted list.
Does it handle Unicode and non-English text?
Yes. The alphabetical sort uses the browser's built-in Unicode Collation Algorithm via localeCompare, so accented characters (é, ü, ñ), CJK characters, and other non-ASCII text all sort in a sensible order.
How random is the Shuffle?
Each shuffle uses a fresh Fisher-Yates shuffle, which produces a uniformly random permutation. Every possible ordering has an equal chance of appearing.
Can I sort lines in a large file?
Yes — click "Upload" to load any plain text file directly into the editor. There's no server involved; everything runs in your browser, so your data stays private. For very large files (millions of lines), a command-line tool like Unix sort will be faster.
Does sorting remove duplicates?
No, this tool only sorts — it does not deduplicate. If you need to remove duplicate lines, try a dedicated tool or combine this with a text editor's built-in "unique lines" feature. Many editors like VS Code support this natively.