Text Whitespace Cleaner

Clean messy text: collapse spaces, trim lines, merge blank lines, strip trailing spaces and normalize line endings, with before-after counts.

All processing happens locally in your browser. Nothing leaves your device.

Before: 0
After: 0
Saved characters: 0

How It Works

You paste your text, pick which cleanup rules you want, and the result appears instantly below — together with a character count comparison. There is no processing step and no waiting: the rules are applied live as you type, so you can toggle options on and off to see exactly what each one removes before you copy the result.

Independent options
Every checkbox is a separate rule. "Collapse multiple spaces" turns "a b" into "a b"; "Trim start/end of lines" removes whitespace at the edges of each line; "Merge blank lines" reduces any run of empty lines to a single blank line. Combine as many as you like — the output reflects the active set instantly.
Line endings, explained
The "Normalize line endings" option converts Windows-style \r\n (and stray \r) into plain \n, the standard used by macOS and Linux. This keeps diffs, scripts and version control happy when text moves between systems.
Live before/after stats
Three counters run alongside the tool: Before (characters in your input), After (characters in the cleaned text) and Saved (the difference). They update on every keystroke and every option toggle, so you always know how much was removed.

Frequently Asked Questions

What exactly gets cleaned up?

Each option is independent and you can combine them: collapse runs of multiple spaces into one, trim whitespace at the start and end of every line, merge several blank lines into a single blank line, strip trailing spaces from lines, trim the whole text block, and normalize Windows line endings (\r\n) to plain \n. The cleaned output updates live as you type.

Does the tool change any of my words or formatting?

No. Only whitespace characters are touched — spaces, tabs and line endings. Word order, punctuation, capitalization and any Markdown or code you care about are left exactly as you typed them. If you only want a light pass, leave just the options you need checked.

Is my text uploaded anywhere?

No. Everything runs locally in your browser with plain JavaScript. Your text never leaves the page, there is no server round-trip and no account, so you can safely paste private notes, code or logs.

Why do I want to normalize line endings?

Windows files use \r\n (CRLF) while macOS and Linux use \n (LF). Mixed line endings can break diffs, scripts and tools like git or linters. Normalizing to \n makes the text behave consistently on every platform, and the stats show you exactly how many characters were removed.

What do the Before/After/Saved numbers mean?

Before counts the characters in your pasted text, After counts the characters in the cleaned result, and Saved is the difference — the number of whitespace characters removed. They update in real time as you type or toggle options.