Skip to content

Sort lines and remove duplicates

Sort lines alphabetically, naturally or by length, remove duplicates and empty lines, and clean up lists, all in your browser.

Result

0 lines
Runs in your browser · no uploadHow it works

How to use Sort lines & remove duplicates

  1. 1

    Paste your list

    One item per line — names, keywords, file names, e-mail addresses, numbers or log lines.

  2. 2

    Build the recipe

    Add steps such as Sort, Remove duplicates or Filter, set their options and reorder them with the arrows.

  3. 3

    Check the counts

    Each step shows how many lines it removed or added, and the result shows the final line count.

  4. 4

    Copy or download

    Copy the result, save it as a .txt file, or move it into the input to keep refining.

Limits and Pro

Free and unlimited with no sign-up; lists of 100,000 lines sort, de-duplicate and filter in well under a second on a typical laptop.

Pro removes ads; every step and preset is free. See Pro

About Sort lines & remove duplicates

Lists pasted from spreadsheets, e-mails, log files and survey exports rarely arrive clean: they are out of order, repeat themselves and carry stray spaces and blank lines. This tool fixes them with a short recipe of steps that run from top to bottom, and the result updates the moment you change the list or any step.

Sorting comes in four flavours. A–Z uses your language's dictionary order, so “éclair” sits with the e's. Natural order reads the numbers inside text, putting file2 before file10 the way people expect. Number sorting uses the first number on each line, understands thousands separators like 1,200 and decimals like 2.5, and puts lines without a number at the end. Length sorting orders lines from shortest to longest.

Duplicate removal can keep the first or the last copy, or drop every line that appears more than once, and can treat “Apple” and “apple ” as the same. Other steps trim spaces, remove empty lines, reverse or shuffle the order, keep or drop lines containing a word or matching a regular expression, find and replace, add a prefix, suffix or line numbers, and join lines into one comma-separated string or split one back into lines.

The shuffle uses 128 bits from your browser's cryptographic random generator and stays put while you edit, until you press Reshuffle. Steps can be reordered, switched off without deleting them, or loaded from presets such as “Alphabetize & remove duplicates”. Your list and recipe are remembered, and Use as input lets you start a new round of cleanup from the result.

Privacy

Sorting, filtering and every other step run in this browser tab, so the list you paste is never transmitted. The list and your steps are stored in local storage to survive a refresh; Clear empties the list, and removing the steps resets the recipe.

Features

Four ways to sort

Dictionary A–Z, natural (file2 < file10), by number and by length, ascending or descending.

Smart de-duplication

Keep the first or last copy, or only lines that appear once, ignoring case and spaces if you like.

Chainable steps

Combine trim, filter, replace, number, join and split in any order with live counts.

Fair random shuffle

Fisher–Yates shuffle seeded from the Web Crypto API, stable until you reshuffle.

Sort lines & remove duplicates: frequently asked questions

How do I remove duplicate lines but keep the original order?
Remove any Sort step and add Remove duplicates on its own. It keeps the first copy of each line where it first appears and deletes later repeats, so the order is unchanged. Choose “Keep last” to keep the final occurrence instead, and tick “Ignore case” if “Apple” and “apple” should count as the same entry.
What is the difference between A–Z and natural sorting?
A–Z compares text character by character, so “file10” comes before “file2” because 1 sorts before 2. Natural sorting reads runs of digits as whole numbers, giving file1, file2, file10 — the order you see in a file manager. Use natural order for file names, version numbers and chapter lists, and A–Z for ordinary words.
How do I sort a list of numbers correctly?
Pick the Number mode in the Sort step. It reads the first number on each line, including negatives, decimals and thousands separators such as 1,200, and orders lines by its value, so 9 comes before 10 and 1,200. Lines that contain no number are placed at the end in both ascending and descending order.
Can I turn a list into comma-separated values and back?
Yes. Add a Join step to merge every line into one, separated by a comma and space or any delimiter you type, including \t for tabs. To go the other way, use Split with a comma, followed by Trim and Remove empty lines — the “Comma-separated → lines” preset sets that up for you in one click.
Is the shuffle truly random?
It uses the Fisher–Yates algorithm, which favours no position over another, driven by a generator seeded with 128 bits from the browser's Web Crypto API rather than the weaker Math.random. The order stays the same while you keep editing so the result doesn't jump around; press Reshuffle for a fresh order.
All text tools