Delete repeated lines from a list while keeping the original order, with options to ignore case, extra spaces and empty lines.
Text Sorter
Sort lines alphabetically, in natural number order, by number or by length, or reverse and shuffle them, with sorting rules for Hindi and other languages.
0 lines · 0 characters
Options
A to Z by the rules of the chosen language. Digits are compared one by one, so file10 comes before file2.
Decides the order of letters, for example Hindi puts Devanagari before English and Swedish puts ä after z.
Capitals come first when lines are otherwise equal (Apple before apple). When off, case is ignored.
When off, empty lines are kept and placed at the end of a sorted list.
Keeps one copy of lines that are exactly the same.
0 lines · 0 characters
Runs entirely in your browser. Your files and text are not uploaded.
How to use Text Sorter
-
Step 1: Paste your list
Type or paste one item per line, or open a .txt or .csv file.
-
Step 2: Pick an order
Choose alphabetical, natural, numbers, length, reverse or shuffle, and the direction.
-
Step 3: Copy or download
The sorted list updates as you type. Copy it or download it as a .txt file.
The sort orders
- Alphabetical sorts with the collation rules built into your browser (Unicode CLDR), so accented letters sit next to their plain letters instead of after z. Digits are compared one at a time.
- Natural works the same way but reads numbers inside a line as whole numbers. This is the order you usually want for file names, chapters and versions.
- Numbers looks at the first number in each line, including negative numbers, decimals such as 2.5 or .5, and grouped numbers such as 1,499 or 1,23,456. Lines without a number are placed after the others.
- Length counts visible characters, so an emoji or a Hindi letter with its vowel sign counts as one.
- Reverse lines turns the list upside down without sorting, and Shuffle puts it in random order using your browser's cryptographic random number generator.
Lines that are equal for the chosen order keep their original order. Empty lines are removed by default. If you keep them, the sort orders put them at the end, while Reverse lines and Shuffle move them with the other lines.
Worked example
Take these four file names:
file10.txt
file2.txt
File1.txt
file1.txt
Alphabetical gives File1.txt, file1.txt, file10.txt, file2.txt, because the character 1 in file10 comes before 2. Natural gives File1.txt, file1.txt, file2.txt, file10.txt. File1 and file1 differ only in case: with Case-sensitive off they keep their original order, and with it on the capital comes first.
For numbers, the lines "Price ₹1,499", "Price ₹250", "-5 °C" and "12.5 kg" sort as -5 °C, 12.5 kg, Price ₹250, Price ₹1,499.
Language rules
Alphabetical order is not the same everywhere. With Hindi, Devanagari words come before English ones, in the order of the Hindi alphabet (अ, आ … क, ख). With English rules they come after. Spanish puts ñ after n, Swedish puts ä and ö after z, and Turkish puts the dotless ı before i. Marathi, Bengali, Gujarati, Tamil, Telugu, Kannada, Malayalam and Urdu put their own script first in the same way.
The rules come with your browser. If it has none for the chosen language, the tool uses general rules and tells you. Chrome, for example, has no Punjabi rules, so Gurmukhi words then come after English ones.
Character codes ignores language rules and sorts by Unicode number, as most programming languages do. With Case-sensitive on, the capitals A to Z then come before the small letters a to z (Zebra before apple).
Privacy
Sorting happens in your browser. Long lists are sorted in a background thread so the page stays responsive. Your list is not uploaded or saved.
Limitations
- Whole lines are sorted. The tool does not sort a CSV file by one of its columns.
- Alphabetical order follows the browser's rules for the chosen language, so it can differ slightly from Excel, a database or another browser.
- Numbers order reads a comma as a thousands separator and a full stop as the decimal point, so 3,5 in European style is read as 3 and 5, not 3.5.
- A shuffled order is different every time and cannot be repeated.
- A file that is not saved as UTF-8 or UTF-16 is read as Windows-1252 (Western European), and the tool tells you when that happens. Files in other encodings may show wrong characters.
Frequently asked questions
Why does file10 come before file2?
Alphabetical order compares one character at a time, and 1 comes before 2. Choose Natural to compare whole numbers, which puts file2 before file10.
Can I sort Hindi words in alphabetical order?
Yes. Choose Hindi under Language rules. Words are sorted in the order of the Devanagari alphabet, and Hindi words come before English ones. The same works for Marathi, Bengali, Gujarati, Tamil, Telugu, Kannada, Malayalam and Urdu. Punjabi depends on your browser: Chrome has no Punjabi rules, and the tool tells you when it uses general rules instead.
What does Case-sensitive change?
When it is off, Apple and apple are treated as equal and keep their original order. When it is on, the capital comes first. With Character codes, the capitals A to Z come before the small letters a to z.
How random is the shuffle?
It uses the Fisher–Yates method with your browser’s cryptographic random number generator, so every order is equally likely. Press Shuffle again for a new order.
Can I remove duplicates while sorting?
Yes. Turn on Remove duplicate lines to keep one copy of lines that are exactly the same. To ignore case or spaces when finding duplicates, use the Remove Duplicate Lines tool.
Is my list uploaded?
No. The list is sorted in your browser and is not sent anywhere or stored.
Related tools
Find text and replace it in one step, with match case, whole word and regular expression options, highlighted matches and a count.
Change text to UPPERCASE, lowercase, Title Case, Sentence case, camelCase, snake_case and more. The result updates as you type.
Count words, characters, sentences and paragraphs as you type, with reading time and keyword density.