Whitespace cleaner
This whitespace cleaner tidies text copied from documents, emails, PDFs or code. It removes stray spaces at line ends, controls blank lines and can squeeze repeated spaces down to one.
- Runs in your browser
- Free, no account needed
- Copy or download the result
Result
The short answer
Cleaning whitespace means trimming spaces and tabs from the ends of lines, trimming the ends of the whole text, and shrinking runs of blank lines. It removes the stray gaps that appear when text is pasted from PDFs, emails or web pages. The words themselves are never changed.
Worked exampleThe sample has trailing spaces, several blank lines in a row and a trailing tab; with blank lines set to single, it becomes Meeting notes, one blank line, then the Agenda line and the Next steps line, with nothing left at either end.
Example
Meeting notes Agenda: budget and hiring Next steps: send the draft by Friday.
Meeting notes Agenda: budget and hiring Next steps: send the draft by Friday.
How to use the whitespace cleaner
- Paste your text into the Text box.
- Set Trim start and end, Blank lines and Inner spacing.
- Enter a number in Tab width; 0 keeps tabs as they are.
- The cleaned text updates as you type. Press Copy result or Download.
How it works
Spaces and tabs at the end of every line are always removed, and Windows line endings become plain line breaks.
Blank lines can be kept, limited to at most one in a row, or removed completely.
Collapse under Inner spacing turns any run of spaces or tabs into one space, including indentation at the start of a line.
Tab width replaces each tab with that many spaces, from 0 to 16. It does not line text up to tab stops.
Inside lines, only regular spaces and tabs are cleaned, so characters like non-breaking spaces stay. If cleaning would leave no text, you get an error.
Everything runs in your browser. Your input is not uploaded or stored. If you use Copy link, what you entered is placed in the link.
Questions and answers
How do I remove extra spaces from text?
Paste the text and set Inner spacing to Collapse. Double spaces become single spaces.
How do I remove blank lines?
Set Blank lines to Remove to delete every empty line, or to Max one to leave single gaps between paragraphs.
Can I convert tabs to spaces?
Yes. Enter a number from 1 to 16 in Tab width, and each tab is replaced by that many spaces.
Is my text uploaded?
No. Cleaning happens in your browser, and your text never reaches a server.
Last updated November 1, 2026. Maintained by SnowRock. How our tools work
All 220 SnowRock tools