Sort Lines & Remove Duplicates
Sort lines A–Z, naturally or by length, and remove duplicate or empty lines
Your files are processed in your browser. They are never uploaded, and nothing is stored after you close the page. How we handle privacy
Runs entirely in your browser. Nothing you type or upload is sent to us or stored.
Results are for general guidance. Please check anything important before relying on it. Terms of use
How to Use
- Paste your list into Your lines, one item per line. It can be names, roll numbers, keywords, email addresses or anything else. You can also open a .txt or .csv file, or click Try a sample.
- Choose how to Sort: A → Z, Z → A, Natural (so 2 comes before 10), shortest or longest first, reverse order, shuffle, or keep the original order.
- Switch on Remove duplicate lines if you need to, and choose whether “Apple” and “apple” count as the same. You can also remove empty lines and trim extra spaces.
- The Result updates straight away. It shows the line count before and after, and how many duplicates or empty lines were removed.
- Click Copy result, save it as a .txt file, or click Use as input to apply another step to the cleaned list.
Sort a list and remove duplicates in seconds
Lists turn up everywhere: student names copied from a WhatsApp group, roll numbers from an Excel sheet, keywords for a blog, product codes, email addresses for a mailing list. This tool lets you sort lines and remove duplicates without opening a spreadsheet. It also clears out blank lines and stray spaces. It all runs in your browser, and the text you paste is never uploaded.
Sort options explained
| Option | What it does | Example result |
|---|---|---|
| A → Z | Alphabetical, ignoring capital letters | apple, Banana, cherry |
| Z → A | Reverse alphabetical | cherry, Banana, apple |
| Natural (1, 2, 10) | Numbers inside lines compared by value | Item 2, Item 9, Item 10 |
| Shortest / Longest first | By number of characters | Om, Ravi, Ananya |
| Reverse order | Last line becomes first | 3, 2, 1 |
| Shuffle | Random order (new order on every click) | Varies |
Why “natural” sorting matters
Ordinary alphabetical sorting compares text one character at a time, so “Roll 10” comes before “Roll 2” because the character “1” comes before “2”. That's rarely what you want for roll numbers, invoice numbers, chapter names or file names. Natural sorting reads the digits as a whole number, giving Roll 1, Roll 2 … Roll 9, Roll 10. A plain list of numbers such as 100, 20, 3 also comes out right, as 3, 20, 100.
How duplicates are removed
The tool processes your text in a fixed order:
2. Remove empty lines (if switched on)
3. Remove duplicates (the first occurrence is kept)
4. Sort
Trimming happens first, so “Delhi” and “Delhi ” (with a trailing space) count as duplicates when trimming is on. With Ignore case switched on, “MUMBAI”, “Mumbai” and “mumbai” are treated as the same line and only the first spelling is kept. If you keep the original order and only remove duplicates, the remaining lines stay exactly where they first appeared.
Worked example
Say you paste these six lines from a class form: “Ravi”, “ananya”, “Ravi”, an empty line, “Om”, “Ananya”. With A → Z sorting, duplicates removed (ignoring case) and empty lines removed, the result is three lines: ananya, Om, Ravi. The counters show 6 lines before, 3 after, 2 duplicates removed and 1 empty line removed.
Tips
- To de-duplicate a column from Excel or Google Sheets, copy the column, paste it here, then paste the result back. Each cell becomes one line.
- Lists with tens of thousands of lines work fine, and the result updates as you change options.
- A → Z sorting uses standard Unicode collation, so lines in Hindi and other Indian scripts are sorted too, and English lines come out in normal dictionary order.
- When two lines differ only in capital letters, A → Z keeps a fixed order between them, so the result is the same every time.