DevKit Tools

Text Cleaner and Line Sorter

Remove duplicate lines, sort alphabetically or by length, trim whitespace, strip blank lines and add numbering.

Transform/Text Cleaner and Line Sorter

Remove duplicate lines, sort, trim whitespace, strip blank lines and number the result.

Result

Lines in

7

Lines out

4

Removed

3

apple
banana
cherry
date

About the text cleaner and line sorter

Lists arrive messy: exported from a spreadsheet with trailing spaces, pasted from two sources with overlap, or padded with blank lines. Cleaning them by hand is slow and easy to get subtly wrong.

Each operation here is separate and applies in a sensible order, so you can trim and deduplicate without sorting, or sort without removing anything. The counts show exactly how many lines were removed, which is the quickest way to spot that a filter did more than you meant.

How to use it

  1. 1Paste your lines.
  2. 2Turn on trimming to remove leading and trailing spaces.
  3. 3Remove blank lines and duplicates as needed.
  4. 4Choose a sort order, or keep the original.
  5. 5Decide whether duplicate matching should be case sensitive.
  6. 6Copy the cleaned result.

Questions

In what order are the operations applied?

Trim, then collapse spaces, then remove blanks, then deduplicate, then sort, then number. Trimming first is what lets two lines that differ only by trailing whitespace be recognised as duplicates.

Which duplicate is kept?

The first occurrence, so the original order of the remaining lines is preserved when you are not sorting.

Does sorting handle accented characters correctly?

Yes. It uses your locale's collation rules rather than raw character codes, so accented letters sort next to their base letter instead of after Z.

Is my data uploaded?

No. Everything runs in your browser.

More Text & Data tools