Remove duplicate lines & sort lines
Remove duplicate and blank lines, and sort lines alphabetically or by number.
Your list
0 characters · 0 lines
0 characters · 0 lines
Everything runs on this device. What you enter is never sent anywhere.
When removing duplicates, the first copy is kept. Numbers are sorted as numbers (2 comes before 10).
Found it useful? We'd love a share
Something not working, or an idea to make it better?
How to use
1. Put in your list
Tap “Paste” on the “Your list” box at the top to put in your lines, one item per line. The “Result” box below shows your list with duplicates and blank lines removed right away.
Click “Paste” above the “Your list” box on the left to put in your lines, one item per line. You can also type, or open a text file with “Open file”. The “Result” box on the right shows your list with duplicates and blank lines removed right away.
2. Choose how to sort
Tap the menu above the “Result” box and choose “A → Z (0 → 9)”. The result is sorted alphabetically, with numbers from smallest to largest, right away.
In the menu above the “Result” box, choose “A → Z (0 → 9)”. The result is sorted alphabetically, with numbers from smallest to largest, right away. To go back to the original order, choose “Don't sort (original order)”.
3. Choose what to remove
Tap “Trim spaces” below the menu to turn it on. Spaces at the start and end of each line are removed, so lines that differ only in spaces are removed as duplicates too. The top right of “Result” shows how many lines you started with and how many are left.
Click “Trim spaces” below the menu to turn it on. Spaces at the start and end of each line are removed, so lines that differ only in spaces are removed as duplicates too. The top right of “Result” shows how many lines you started with and how many are left.
4. Copy or save
Tap “Copy” below the result to copy all the cleaned-up lines. Tap “Download text” to save them as a .txt file.
Click “Copy” below the result to copy all the cleaned-up lines. Click “Download text” to save them as a .txt file.
Great for
Removing duplicate names or email addresses
Paste a list gathered from sign-up forms or several contact lists, and every name or address that shows up more than once is cut down to one. You can also see how many duplicates were removed.
Office staff and event organizers
Putting a list in alphabetical order
Sort names of attendees or products from A to Z. Numbers like “Part 2” and “Part 10” are put in the right order, smallest first.
Anyone making lists or documents
Cleaning up keywords or URLs
Remove repeated entries and blank lines from lists of search keywords, tags, URLs or logs in one go. Words that differ only in upper and lower case can be treated as the same, too.
Marketers and engineers
Getting it done without a spreadsheet
For small lists where opening Excel to remove duplicates or sort feels like overkill. Even on a phone, you just paste and copy.
People working on their phone
Good to know before you start
- It can't sort CSV data by column. Each line is treated as one piece of text.
- Full-width and half-width characters (“A” and “A”) are not treated as the same line. Make them match first.
- It can't replace text or swap words within a line.
About removing duplicate lines and sorting
This tool splits what you enter into lines at each line break and cleans them up in a fixed order. First it trims spaces (when turned on), then removes blank lines, then removes duplicates, and finally sorts. When removing duplicates, it keeps the first copy of each line, so if you don't sort, your list stays in its original order.
Sorting follows the rules of the page's language. In English, upper and lower case letters are mixed together in alphabetical order (“apple”, “Banana”, “cherry”). Lines with numbers, such as “item2” and “item10”, are compared by the numbers' values rather than character by character, so 2 comes before 10.
FAQ
Answers to common questions before you start.
Is my text sent anywhere?
No. All the processing happens in the browser on your device, and what you enter is never sent to a server or stored. You can safely clean up personal information such as name lists and email addresses.
When there are duplicates, which line is kept?
The first one is kept, and later copies of the same line are removed. If you leave it on “Don't sort (original order)”, the remaining lines stay in the same order as your original list.
Can lines that differ only in spaces be removed as duplicates?
Yes. Turn on “Trim spaces”, and spaces and tabs at the start and end of each line are removed before comparing, so “ apple” and “apple” become the same line. Spaces in the middle of a line are kept.
Are upper and lower case treated differently?
Yes, by default. Turn on “Ignore case” to treat “Apple” and “apple” as the same line. The spelling that appears first is kept.
Are lines with numbers sorted correctly?
Yes. Numbers in a line are compared as numbers, not as text, so you get “1, 2, 10” (comparing as text would give “1, 10, 2”).
Can I remove only duplicates and keep blank lines?
Yes. Turn off “Remove blank lines”. Blank lines are then not removed as duplicates, so your paragraph breaks stay intact.
Can I see how many lines were removed?
Yes. The top right of the “Result” box shows the number of lines you entered and the number in the result, like “10 lines → 6 lines”. The numbers of duplicate and blank lines removed are shown separately too.
Can I clean up Excel tables or CSV files?
If you copy and paste the cells, each row is cleaned up as a line. However, you can't pick a column to sort by; each line is sorted as one piece of text. Text files (.txt, .csv, and so on) can be opened with “Open file”.
How many lines can it handle?
It can handle lists with hundreds of thousands of lines. For long lists, processing runs in the background after you stop typing, so the page doesn't freeze. Files up to 20 MB can be opened.
Is it free?
Yes, it's free. No sign-up needed, and no ads.
More tools
- Convert full-width and half-width
Convert letters, numbers and katakana between full-width and half-width in one go.
- Hiragana ⇔ katakana converter
Convert between hiragana, katakana and half-width katakana in one go. Kanji, letters and numbers are left as they are.
- Character Counter for X, Instagram & YouTube
See how many characters you have left before the limit on X, Instagram, YouTube and more, counted the way each platform does. Also shows characters, lines, words and bytes.
- JSON formatter
Pretty-print JSON or minify it to one line. If there's a mistake, it shows you where.
- URL Encode / Decode
Encode text and symbols into a URL-safe form (like %C3%A9) or decode it back to the original text.
- Password generator
Choose the length and characters to make hard-to-guess passwords on the spot.