dilettanteee
tools/text-utilities/whitespace-cleaner

Whitespace Cleaner

Collapse extra spaces, trim lines, and tidy up blank lines.

Text
Output

Cleaned text appears here.

More in this kitAll of Text Utilities

About Whitespace Cleaner

The Whitespace Cleaner removes the invisible mess that creeps into text copied from PDFs, emails and web pages: doubled spaces, stray tabs, trailing spaces and piles of empty lines. The result is tidy text that is ready to paste somewhere else.

How to use it

  1. Paste your text into the input panel.
  2. Choose the clean-up options you want: Collapse spaces, Trim lines, Collapse blank lines and Normalize line endings.
  3. Copy the cleaned text from the output panel.

Good to know

  • Collapse spaces turns runs of spaces and tabs into a single space.
  • Trim lines removes spaces at the start and end of every line.
  • Collapse blank lines reduces three or more consecutive line breaks to a single empty line, keeping paragraph breaks intact.
  • Normalize line endings converts Windows-style line endings to the standard newline character, which avoids odd behavior in code editors and version control.

Common questions

Why does text copied from a PDF have strange spacing?

PDFs position words individually rather than storing flowing text, so copying often produces extra spaces and line breaks. Collapse spaces and Trim lines fix most of it.

Will this remove indentation from code?

Trim lines and Collapse spaces both affect leading whitespace. Switch them off if you need to keep indentation.