Whitespace & Line Ending Cleaner

Trim lines, collapse extra spaces, remove blank lines, normalize line endings (LF/CRLF), and convert tabs to spaces. All in your browser.

Runs 100% in your browser — nothing is uploaded.Use this in a chain
Result
69 → 58 chars (84%)

How to use

  1. 1
    Paste your text

    Any messy input — email replies, HTML source, log output, pasted PDF text.

  2. 2
    Pick the cleanups you want

    Trim each line, collapse blank lines, or convert tabs to spaces are the most common combo.

  3. 3
    Read the cleaned output

    Live update. Character count shows what you saved.

  4. 4
    Copy the result

    One click, ready to paste into your document or code.

Examples

Trim trailing spaces + collapse blank lines
Input
Line 1   


   Line 2 with leading spaces


Line 3
Output
Line 1

   Line 2 with leading spaces

Line 3
Blank-line collapse leaves one blank between paragraphs — code-friendly, prose-friendly.
Tabs → 2 spaces
Input
	if (x) {
		doStuff();
	}
Output
  if (x) {
    doStuff();
  }
Common fix for pasted code that uses tabs while your codebase uses spaces.
Normalize CRLF → LF
Input
Line 1\r\nLine 2\r\nLine 3
Output
Line 1\nLine 2\nLine 3
Fixes files that traveled through a Windows editor. Git-friendly.
Nuke everything blank
Input



First


Second



Third


Output
First
Second
Third
"Remove blank lines" is the aggressive option — no space between paragraphs at all.

Frequently asked

LF vs CRLF — which do I want?

LF for Unix, macOS, and modern editors. CRLF for legacy Windows tools. Modern codebases target LF and let Git handle line ending conversion.

Does "collapse spaces" affect indentation?

Yes — if you turn it on it collapses ANY run of spaces to one, which will flatten indentation. Leave it off for code.

What is "trim each line" for?

Removes leading and trailing spaces/tabs from every line. The most common cleanup for pasted text.

Will it break my Markdown or code indentation?

Trim lines and remove blank lines both preserve leading whitespace on lines that have non-whitespace content, so Markdown code blocks and Python code are safe. Only "collapse spaces" changes indentation — leave that off for code.

Does it remove non-breaking spaces?

Not by default — regular ASCII spaces and tabs only. Non-breaking spaces (U+00A0) and other exotic whitespace stay put unless you explicitly search-and-replace them elsewhere.

Related tools