Free tool

Line Sorter and Duplicate Remover

Sort, remove duplicates, reverse or shuffle a list of lines instantly. 100% in your browser.

Sort

Built by

Miguel Ángel Colorado Marin (MACM)

Full-Stack Developer · Guadalajara, España

I develop web apps, digital tools and full projects — from design to deployment.

Contact me

This tool works on text lists line by line. You can sort them A to Z or Z to A, remove duplicate lines, reverse the order, shuffle them at random or remove empty lines. Removing duplicates, reversing and removing empty lines can be combined; the order (A→Z, Z→A or shuffle) is a single choice at a time. Paste your list and the result updates instantly with the line counter. All processing runs in JavaScript in your browser.

Features

  • ✓A→Z or Z→A sort with natural numbers (item2 before item10)
  • ✓Random shuffle (Fisher-Yates)
  • ✓Remove duplicate lines (case-sensitive)
  • ✓Reverse the order
  • ✓Remove empty lines
  • ✓Line count before and after
  • ✓100% in browser, no uploads

How to sort or clean up a list of lines?

  1. 1

    Paste your list

    One item per line, in the box on the left.

  2. 2

    Choose the sort order

    Unsorted, A→Z, Z→A or Shuffle. Only one sort mode can be active.

  3. 3

    Turn on the extra options

    Remove duplicates, reverse order and remove empty lines can be combined.

  4. 4

    Copy the result

    The result updates instantly. The Copy button sends it to the clipboard.

Operations and how they combine

Each line is the text between two line breaks (\n). The tool always applies the operations in the same order, so with the same options and the same shuffle the result does not change.

Natural order: when sorting A→Z or Z→A, numbers are compared by value, so «item2» comes before «item10». Accented letters sit next to their base letter, and the comparison uses the rules of the interface language: in Spanish, ñ sits between n and o.

Remove duplicates: compares the exact text of each line, so «Cat» and «cat» are different, and «cat» and «cat » (with a trailing space) are different too. The first occurrence of each line is kept.

Remove empty lines: deletes lines with no characters or with only spaces and tabs. Lines that contain text are not trimmed, so their leading and trailing spaces are kept.

Reverse order: flips the final result, after sorting or shuffling and after removing duplicates and empty lines. With Z→A active, reversing produces A→Z.

When the tool opens, sorting is set to Unsorted and removing empty lines is on; duplicates, reversal and shuffle start off. You can change any option at any time and the result is recalculated from the text in the left box. Changing an option never edits the original text.

Random shuffle, limits and counters

The shuffle builds a permutation with Math.random and the Fisher-Yates algorithm, so every possible order has the same probability. The permutation is kept while the text does not change, so turning duplicates, empty lines or reversal on or off does not reshuffle the lines.

Since only one sort mode can be active, choosing Shuffle replaces A→Z and Z→A. Every change to the original text produces a new shuffle, and the «Shuffle again» button reorders the same text.

The tool sets no limit on the number of lines or on size. Everything happens in the memory of the tab, so very large lists can take longer to process.

The counter in the left column counts the lines of the original text and the one on the right counts the lines of the result. A trailing line break counts as one extra empty line in the original, and the result always uses \n line breaks.

Frequently asked questions

Is my list uploaded to a server?

No. The text is processed with JavaScript in your browser and is not sent anywhere.

In what order are the options applied?

First the saved shuffle (if active), then empty or whitespace-only lines are removed, then duplicates, then the A→Z or Z→A order, and finally the reversal.

How does "remove duplicates" work?

It compares each line as exact text: uppercase and lowercase are different and extra spaces count. It keeps the first occurrence of each line.

How are numbers and letters sorted?

Numbers are compared by value, so item2 comes before item10. Letters are compared ignoring case first; when two lines differ only in case, the lowercase one comes first. The order follows the interface language: in Spanish, ñ sits between n and o.

Is the shuffle truly random?

It uses Math.random with the Fisher-Yates algorithm, which gives every possible order the same probability. It is not a cryptographic generator, so do not use it for prize draws. Each change to the text produces a new shuffle; «Shuffle again» reorders the same text.

Which line breaks does the result use?

Always \n. Leading and trailing spaces on each line with text are kept.

Related tools

Embed Line Sorter and Duplicate Remover on your site

Add Line Sorter and Duplicate Remover to any web page with a simple iframe. Free, with attribution to miguelacm.es.

<iframe
  src="https://miguelacm.es/embed/line-tools?locale=en"
  width="100%"
  height="700"
  frameborder="0"
  allow="clipboard-write"
  title="Line Sorter and Duplicate Remover — miguelacm.es"
></iframe>
View embed in new tab →