Text Cleaner
Choose what to clean, press Clean Text, and check the result before you use it. Your text stays on your device.
Add text, choose options, then press Clean Text. A short summary appears here.
Cleaning options
How to clean text
Add text
Type or paste plain text, or import a local .txt file.
Choose options
Only trimming line edges is selected at first. Tick what else you want.
Clean and check
Press Clean Text, read the summary, then copy or download the result.
The order of the steps
Selected options always run in this order, whatever order you tick them in. Earlier steps change what later steps see.
- Line breaks are read as line breaks, whether they are CRLF, CR or LF.
- Non-breaking spaces become ordinary spaces (if selected).
- Tabs become spaces (if selected).
- Whitespace at the start and end of each line is trimmed (if selected).
- Runs of ordinary spaces become one space (if selected).
- Duplicate lines are removed (if selected).
- Blank lines are removed or collapsed (if selected).
- Lines are joined with LF or CRLF, and the final line break is kept, added or removed.
What each option does
- Whitespace. Whitespace means spaces, tabs, non-breaking spaces and the other Unicode space characters. Zero-width characters are not whitespace and are never removed. Collapsing repeated spaces affects ordinary spaces only, indentation included. Each tab becomes the chosen number of spaces; it does not align to tab stops.
- Blank lines. A blank line is empty or holds only whitespace. Remove all blank lines overrides Collapse consecutive blank lines, which keeps one blank line from each run.
- Duplicate lines. Duplicates are whole lines, not repeated words or sentences. The first occurrence stays and the order never changes; lines are not sorted. Matching is case-sensitive unless you tick Ignore case, and you can ignore leading and trailing whitespace when matching. The kept line is the first one, as the earlier steps left it. Blank lines are never counted as duplicates, so paragraph breaks survive; use the blank-line options for them.
- Line endings and the final line break. Output uses LF or CRLF as you choose. The text boxes always show line breaks the same way, so CRLF applies to Copy Output and Download .txt. By default the output ends with a line break only if the input did.
The summary
After cleaning, the summary shows how many duplicate lines and blank lines were removed, whether whitespace changed on the lines that remain, and whether the final line break or line endings changed. It says “No changes needed” when the output is identical to the input. It does not turn a shorter text into a number of edits, because one edit can remove many characters.
The output is not updated as you type. If the text or options change after cleaning, the output is marked out of date until you press Clean Text again.
What is never changed
- Punctuation, HTML tags and other markup
- Capitalisation (Ignore case only affects matching duplicates)
- Accents, emoji and other Unicode characters, which are not normalised
- Zero-width characters
- Paragraphs, which are never merged
Right-to-left text is kept as it is and the boxes take their direction from the first letter. Text is shown as plain text, never as HTML.
Swap, Undo and saving
- Swap output into input. Replaces the original text with the cleaned text so you can clean it again. Undo brings the previous original back.
- Clear, Import and Load example. Clear empties both boxes. Import replaces the original with a UTF-8 .txt file, and Load example fills it with made-up text. Undo restores the previous original after each of them.
Limits
- 2 MB
- 50,000
Longer texts are refused with a message rather than cut. Cleaning runs in a background thread (a Web Worker) so the page stays responsive, and duplicate lines are found in a single pass.
What happens to your text
Everything runs in your browser. Your text is not uploaded and is not sent to any server. It is not saved in the browser and not put in the page address. Refreshing or closing the tab discards it. See Privacy.
Not included
- Sorting lines
- Removing punctuation or HTML
- Changing capitalisation
- Word, PDF or rich-text documents
Frequently asked questions
Is my text uploaded?
No. It is cleaned in your browser. The site only delivers the page and its code.
Why did a duplicate line stay?
Lines must match completely. “Apple” and “apple” differ unless you tick Ignore case, and lines that differ only in spaces differ unless you tick Ignore leading and trailing whitespace. Blank lines are never treated as duplicates.
Why are some spaces still there after collapsing?
Only ordinary spaces are collapsed. Tabs and non-breaking spaces stay unless you also convert tabs or replace non-breaking spaces.
Can I sort the lines?
No. The order of your lines never changes.
Do I need an account?
No. The tool is free and needs no sign-in.