TEXT & WRITING

Text Cleaner

Remove duplicate lines, delete blank lines, trim extra spaces, and sort lines A to Z. Paste a list or any text and the cleaned version updates as you change the options.

Clean up

One item per line. Up to 1,000,000 characters.

Sorting ignores letter case and puts numbers in natural order, so item 2 comes before item 10.

Paste text to clean it.

How to remove duplicate lines and sort a list

  1. Paste your text, with one item per line.
  2. Choose what to clean up. Removing duplicates, removing blank lines, and trimming spaces are on by default.
  3. Pick a line order, then copy the cleaned text, or choose Use as input to clean it again.

How the cleanup works

The steps run in a fixed order: trim each line, replace repeated spaces, remove blank lines, remove duplicates, and then sort. Trimming first means that apple and apple with a trailing space count as the same line.

When duplicates are removed, the first copy of each line is kept in its original position. With Ignore case, Apple and apple count as the same line and the first spelling is kept. Line breaks in the output are always plain new lines.

Example: cleaning a messy list

A text cleaner tidies lists copied from spreadsheets, emails, or exports, where blank lines, stray spaces, and repeats creep in. With every option on, Ignore case included, and Sort A to Z, this list:

Banana
apple
  apple

Cherry
banana

Date

becomes:

apple
Banana
Cherry
Date

The status line reports “8 lines in, 4 lines out (2 duplicates removed, 2 blank lines removed).” The second apple counts as a duplicate only because trimming runs first and removes its spaces, and banana matches Banana only because case is ignored.

Text cleaner FAQ

Can I shuffle the lines instead?

Use the list generator, which shuffles a list or picks random items from it.

Is my text saved?

No. Cleaning runs in this page and nothing is sent to a RandomTools application server or saved. The privacy policy describes the separate advertising script that runs on this page.

How do I remove duplicate lines but keep the order?

Turn on Remove duplicate lines and leave Line order on Keep original order. The first copy of each line stays where it was and later copies are dropped.

How do I sort a list alphabetically?

Choose Sort A to Z or Sort Z to A. Sorting ignores letter case and puts numbers in natural order, so item 2 comes before item 10.

What other text tools are there?

The word counter counts words and characters, the case converter changes capitalization, and the diff checker compares two versions of a text.

Last updated: