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. A common prep step before diffing two lists is to sort both of them first, so a text comparison tool can line up matching entries instead of flagging every reorder as a change. 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

1

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.

2

Choose a sort option

Click A→Z, Z→A, Length↑, Length↓, Reverse, or Shuffle. The sorted result appears instantly in the right panel.

3

Copy or download

"Copy" takes the sorted list, and "Download" saves 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

Input Text
Tokyo
Berlin
Sydney
Amsterdam
Chicago

→ A → Z

Sorted Output
Amsterdam
Berlin
Chicago
Sydney
Tokyo

FAQ

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. The sorting is done on this page with no server in the loop, so the list never leaves your machine. 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.

Related Tools