Text Cleaner
Trim spaces, remove empty or duplicate lines, sort and number lines.
Tidy up messy lists and pasted text line by line
Text Cleaner fixes the small problems that come with copied text: stray spaces at the ends of lines, double spaces and tabs in the middle, blank lines, repeated entries. It can also sort the lines and number them.
Each clean-up step is a separate checkbox, and the ticked steps always run in the order they are listed, so the same settings give the same result every time. The text is processed by this page in your browser as you type and is not sent anywhere.
How to clean up a block of text
- Paste your text into the “Text to clean” box.
- Choose the clean-up steps. Trimming spaces at the start and end of each line and replacing repeated spaces and tabs are ticked to begin with; everything else is off until you tick it.
- Pick A → Z or Z → A under “Sort lines” if you want the lines in order.
- Read the cleaned text in the box below. It updates with every change you make.
- Click Copy result, or “Use result as input” to run the cleaned text through another round with different settings.
What happens to each line
- The order is fixed: trimming, spaces, line breaks, empty lines, duplicates, sorting, then numbering — so numbers always follow the final order.
- Trimming and collapsing cover spaces, tabs and non-breaking spaces. A run of two or more becomes one space; a single tab inside a line is left alone.
- Empty lines include lines that hold nothing but spaces or tabs.
- Duplicates must match exactly, including capital letters. The first copy stays where it was.
- The counter under the result shows lines before and after, plus how many empty lines and duplicates were removed.
Jobs it handles well
- Lists copied from a PDF or spreadsheet, which often arrive with trailing spaces, tabs and gaps between rows.
- Email or sign-up lists: drop repeated addresses before importing them somewhere else.
- Tags, keywords and file names: sort them and remove repeats to see what is really there.
- Notes for a document: number a plain list of points before pasting it into a report.
Getting the clean-up you intended
- Keep trimming switched on when removing duplicates. Otherwise “apple” and “apple ” with a trailing space count as two different lines.
- Blank lines count as duplicates of each other, so Remove duplicate lines also keeps only the first blank line. To keep paragraph breaks, run it on a list rather than on paragraphs.
- Duplicate matching is case-sensitive, so “Paris” and “paris” both stay. Make the case consistent first with the Case Converter, then clean.
- To see exactly which lines changed, paste the original and the cleaned version side by side into the Text Diff Checker.
- Normalize line breaks uses LF line endings and keeps a single blank line wherever there were several in a row, which suits paragraphs copied from a PDF. To drop blank lines altogether, tick Remove empty lines instead.
Text Cleaner: common questions
How does the sorting handle numbers and capital letters?
It sorts in natural order, so “item 2” comes before “item 10”. Capital letters and accents are ignored when comparing, which keeps “apple”, “Apple” and “Äpple” next to each other.
Which duplicate is kept?
The first occurrence, in its original position. Later copies are removed, and the counter tells you how many went.
Can I number the lines without sorting them?
Yes. Leave “Sort lines” on Don’t sort and tick “Number the lines”. Each line gets a prefix such as “1. ” in its current order.
Will it remove spaces between words?
No. Only runs of two or more spaces or tabs are shortened to a single space, and only when that step is ticked. Normal single spaces between words are untouched.
Is there a size limit?
There is no fixed limit. Very long texts depend on how much your browser can handle, since every change re-runs the clean-up on your device. For counts of words and characters, try the Word Counter.

