Results are provided for informational purposes only and may contain errors. Please verify important information independently. Use of this tool is at your own risk.
What the Whitespace Trimmer does
The Whitespace Trimmer cleans up messy text in one click. It removes trailing spaces and tabs at the end of every line, collapses runs of three or more line breaks into a single blank line, and trims whitespace from the very start and end of the text. The cleaned text replaces the original in the box, ready to copy.
Indentation inside the text is kept, so code blocks and nested lists keep their structure; only the first line loses any leading whitespace, because the whole text is trimmed at the start. Trailing whitespace is invisible but causes noisy diffs, failing lint checks and broken Markdown line breaks, so trimming it before committing or pasting avoids surprises. The text is processed in your browser.
When to use it
- Cleaning text copied from a PDF, a web page or an email before pasting it elsewhere.
- Removing trailing spaces that make a linter or a code review complain.
- Tidying Markdown or plain-text notes with uneven blank lines.
- Preparing two texts for the Text Diff Checker so that only real changes show.
Worked example
Input
First line
Second line
Third line
Output
First line
Second line
Third lineCommon questions about the Whitespace Trimmer
Does it remove spaces between words?
No. Spaces inside a line are left alone. Only whitespace at the end of each line, extra blank lines and whitespace at the start and end of the whole text are removed.
Why keep one blank line instead of removing them all?
A single blank line separates paragraphs in Markdown, emails and most text formats. Keeping one preserves the structure while removing accidental gaps.
Will it break Markdown line breaks?
Two trailing spaces force a line break in Markdown, and trimming removes them. Use a backslash at the end of the line or a <br> tag instead; both survive trimming.
How do I stop trailing whitespace from coming back?
Most editors can trim on save: in VS Code enable files.trimTrailingWhitespace. An .editorconfig file with trim_trailing_whitespace = true applies the same rule to the whole team.
Is this tool free?
Yes, it's free to use. No signup, no email required. Get results on this page.
How do I get my result?
Use the tool on this page. Your result appears here; no email delivery is required.