Guide
How to Clean Up Whitespace and Extra Spaces in Text
Text copied from PDFs, emails and web pages often arrives with double spaces, stray tabs, indents on every line and empty lines scattered through it. Cleaning that by hand is tedious — a whitespace cleaner fixes the whole paste in one pass.
What the cleaner fixes
The tool tidies every line of your text: it trims spaces from the start and end of each line, and collapses any run of spaces or tabs inside the line down to a single space. So " Hello world " becomes "Hello world".
Removing blank lines
Tick the "Remove blank lines" option and every empty line disappears, leaving a compact list. Leave it unticked and blank lines are kept — useful when empty lines separate paragraphs you want to preserve.
Why messy whitespace matters
Extra whitespace causes real problems:
- Spreadsheets and databases treat "apple " and "apple" as different values
- Duplicate-line removers and sorters miss matches when spacing differs
- Code and config files can break on stray tabs or trailing spaces
- Pasted lists look ragged in documents and emails
Worked example
Paste in " Hello world " followed by two blank lines and " A cleaner list ". The result is "Hello world", the blank lines (or not, if you ticked the option), and "A cleaner list" — every line trimmed, every gap reduced to one space. Click Copy result to grab the cleaned text.
A tidy text workflow
Whitespace cleaning works best as the first step: clean the text, then run it through Remove Duplicate Lines to drop repeats, then Text Line Sorter to put it in order. Three free tools, one tidy list.
Try it yourself
Put this guide into practice with our free Whitespace Cleaner — no sign-up, no download.
Open the Whitespace Cleaner