Sort Lines Online - Alphabetize and Remove Duplicates

Tools / Text Tools / Sort Lines

Sort lines and remove duplicates

Lines before
—
Lines after
—
Duplicates removed
—
Empty lines removed
—

How to sort lines and remove duplicates

Paste any list with one item per line: names, email addresses, keywords, file names, product codes. The result updates as you type. Spaces at the ends of lines and empty lines are cleaned first, so "apple" and "apple " count as the same line. Nothing is uploaded; the sorting happens in your browser.

Three steps

  1. 1 Paste your list into the left box, one item per line.
  2. 2 Pick an order and tick the clean-up options you want: duplicates, case, spaces, empty lines.
  3. 3 Check the line counts under the boxes and copy the result.

Why does file10 come before file2?

Plain alphabetical sorting compares character by character, and the character "1" comes before "2", so file10, file11 and file100 all land before file2. Natural order reads a run of digits as one number, which puts file2 before file10 the way people expect. Use natural order for file names, versions, chapters and anything numbered; use plain A → Z only when you need strict character order.

Alphabetical order depends on the language

A naive sort compares character codes, which puts every capital letter before every small one (Zebra before apple) and accented letters after z (Éclair after zebra). This tool sorts with the rules of the page language instead: capitals and small letters are mixed in true alphabetical order, accented letters sit next to their base letter, and languages with their own alphabet order are respected, for example Turkish ç after c and ı before i, or Spanish ñ after n.

How duplicates are found

Two lines are duplicates when they are exactly the same after trimming. The first one is kept and later copies are dropped, so "Keep original order" with duplicate removal gives you a clean list without reshuffling it. With "Ignore case" on, Apple, APPLE and apple count as one line and the first spelling wins. Check the counter: if far more lines disappear than you expected, look for near-duplicates such as a missing letter.

A fair shuffle

Shuffle uses the Fisher-Yates method with the browser’s cryptographic random generator, so every possible order is equally likely. The popular shortcut of "sorting with a random comparison" is biased: some items tend to stay near where they started. For a giveaway or a random speaking order, paste the names, pick Shuffle and press "Shuffle again" for a fresh draw.

Sorting lines: common questions

Choose "Keep original order" and leave "Remove duplicate lines" ticked. The first occurrence of each line stays where it was and later copies are removed. The counter under the boxes shows how many duplicates were dropped.
New
Online Notepad Write notes in your browser with no sign-up. Text is saved automatically on this device, never uploaded. Word and character count, .txt download.
Popular Today
Word Counter Free word counter: paste any text to count words, characters, sentences and paragraphs, and see the estimated reading time - nothing leaves your browser.

Other text tools

Word Counter Free word counter: paste any text to count words, characters, sentences and paragraphs, and see the estimated reading time - nothing leaves your browser.
Character Counter Free character counter: count characters with and without spaces, plus words and lines, and check SEO limits for titles and meta descriptions.
Lorem Ipsum Generator Free Lorem Ipsum generator: create placeholder text by paragraph, sentence or word count, with optional HTML tags for your design mockups.
Case Converter Free case converter: switch any text between lowercase, UPPERCASE, camelCase, PascalCase, snake_case, kebab-case and CONSTANT_CASE in one click.
Text Diff Compare two texts and see exactly what changed. Line or word level, side by side or inline, with neither text ever leaving your browser.

Other Tools You May Like

Word to PDF Convert Word to PDF for free: upload a DOC, DOCX, ODT or RTF file and download a properly formatted PDF in seconds - no registration or watermark.
PDF to Word Convert PDF to Word for free: upload a PDF and download an editable DOCX in seconds - no registration, no watermark and nothing to install.
MD5 Hash Generator Free MD5 hash generator: turn any text or file into an MD5 checksum in your browser - useful for integrity checks and quick fingerprinting.
Base64 Encoder & Decoder Free Base64 encoder and decoder: convert text or files to Base64 and back, entirely in your browser - nothing is uploaded to a server.
Keyword Density Checker Free keyword density checker: paste text or a URL to see how often each word and phrase appears, with percentages for one, two and three-word terms.