Skip to main content
UploadFree

Text Cleaner

Choose what to clean, press Clean Text, and check the result before you use it. Your text stays on your device.

Your original text is not changed until you swap the output into it. Ctrl+Enter (Cmd+Enter on Mac) also cleans.

Read only

Add text, choose options, then press Clean Text. A short summary appears here.

Text stays in this tab only. It is not saved, so refreshing or closing the page clears it.

Cleaning options

Steps run in a fixed order: non-breaking spaces, tabs, trimming, repeated spaces, duplicate lines, blank lines, then line endings. Nothing else is changed: punctuation, HTML, capitalisation, accents, emoji and zero-width characters stay as they are.

Whitespace

Removes spaces, tabs and non-breaking spaces from both ends of every line. Spaces inside a line stay.

Turns two or more ordinary spaces in a row into one, anywhere in a line, indentation included.

Replaces each tab with the number of spaces chosen here. It does not align to tab stops.

Turns each non-breaking space (U+00A0) into an ordinary space, so the options above treat it like one.

Lines

Removes empty lines and lines that contain only whitespace.

Keeps one blank line from each run of blank lines.

Keeps the first occurrence of each complete line, in the original order. It compares whole lines, not repeated words or sentences. Blank lines are never counted as duplicates.

Line endings

The text boxes always show line breaks the same way. CRLF applies to Copy Output and Download .txt.

Final line break

An output with no lines never gets a line break.

How to clean text

  1. Add text

    Type or paste plain text, or import a local .txt file.

  2. Choose options

    Only trimming line edges is selected at first. Tick what else you want.

  3. 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.

  1. Line breaks are read as line breaks, whether they are CRLF, CR or LF.
  2. Non-breaking spaces become ordinary spaces (if selected).
  3. Tabs become spaces (if selected).
  4. Whitespace at the start and end of each line is trimmed (if selected).
  5. Runs of ordinary spaces become one space (if selected).
  6. Duplicate lines are removed (if selected).
  7. Blank lines are removed or collapsed (if selected).
  8. 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

maximum text size
2 MB
maximum lines
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.