Text tool

Sort Lines

Sort lines alphabetically or by number, A to Z or Z to A, with natural sorting so item 2 comes before item 10. Duplicates are kept. Free, in your browser.

Your file never leaves your device.

Arabic and Urdu

Runs locally in your browser

Your text is not uploaded.

Simple steps

How it works

  1. 01

    Enter a list with one value on each line.

  2. 02

    Choose ascending or descending order.

  3. 03

    Copy the sorted lines from the output.

How lines are compared

Lines are sorted the way a dictionary in the text's language would order them, not by raw character codes. Capital and small letters are treated alike, and numbers inside a line are compared by value, so file1.txt, File2.txt and file10.txt stay in that order instead of putting file10 before file2.

The language is detected from the text, which matters for letters such as ä, ñ or ç: a German list puts Äpfel next to Apfel, and a Spanish list places ñ after n.

Arabic and Urdu options

For Arabic and Urdu text, you can ignore short-vowel marks (harakat) and treat Arabic and Urdu forms of the same letter as one: ي and ی, ك and ک, and ه, ہ and ھ. Lines that differ only in these details then sort next to each other instead of far apart.

Tips

Every line is kept, including duplicates and blank lines; blank lines sort to the top in ascending order. To get a clean, unique list, sort first and then use Remove Duplicate Lines. Choose descending order for Z to A or for the largest numbers first.

A line is sorted as a whole, so to sort a table by a column other than the first, put that column first or use a spreadsheet.

Good to know

Frequently asked questions

How are numbers sorted?

Natural sorting compares number groups by numeric value, so item 2 sorts before item 10.

Is sorting case-sensitive?

No. Letter case is ignored when comparing lines.

Are duplicate lines removed?

No. Sorting keeps every line, including duplicates.

Are blank lines kept?

Yes. Blank lines are sorted along with the other lines.

Does sorting upload my text?

No. Sorting happens locally in your browser.