Cleaning Up Messy Whitespace
Paste text and this tool collapses repeated spaces and tabs into single spaces, trims whitespace from the start and end of every line, and reduces runs of blank lines down to one. Line structure is preserved — it tidies spacing rather than reflowing your text.
Whitespace problems are invisible until they are not. Text looks fine in an editor, then arrives in a CMS with double spaces mid-sentence, trailing tabs, and four blank lines where you wanted one.
What it cleans
- Repeated spaces — multiple spaces between words collapse to one.
- Tabs — converted to a single space, since tabs render unpredictably in HTML.
- Trailing whitespace — spaces and tabs at the end of each line, which are invisible but real.
- Leading whitespace — indentation carried over from a source that used it.
- Excess blank lines — three or more consecutive blank lines reduce to one.
Where messy whitespace comes from
Copying between applications is the main source. Word processors, PDFs, spreadsheets and web pages each represent spacing differently, and pasting across them frequently produces artefacts that were invisible in the original.
PDFs are the worst offender. Text extracted from a PDF often arrives with spaces used for visual alignment, line breaks mid-sentence where the page column ended, and inconsistent gaps between words.
The double space after a full stop is a habit rather than an artefact, learned on typewriters where monospaced fonts needed the extra gap. In proportional fonts it is unnecessary, and in HTML it collapses to a single space anyway — so it survives in your source, does nothing visible, and inflates your character counts.
Why it matters more in HTML than it looks
HTML collapses consecutive whitespace when rendering, so double spaces in your source usually look fine on the published page. That is why the problem persists — nothing appears broken.
It still matters in three places. Character counts include it, so a meta description with stray double spaces hits the truncation limit sooner than its visible length suggests. Text extraction — by search engines, screen readers, or your own tooling — sees the raw source. And any field that preserves whitespace, such as a pre block or a plain-text export, renders the mess visibly.
It also matters for comparison. Two texts identical apart from spacing will not match in a diff or a duplicate check unless the tool normalises first, which is why cleaning before comparing is worth the extra step.
What it deliberately does not do
Line breaks are preserved. The tool tidies spacing within and around lines rather than reflowing paragraphs into one block, because collapsing your line structure would usually destroy the formatting you wanted.
One blank line between paragraphs is kept. Only runs of three or more collapse, so normal paragraph separation survives intact.
Single spaces are never touched, and no punctuation or capitalisation is altered. For those, the Case Converter handles capitalisation and the Sentence Case Converter fixes text that arrived in all caps.
Where it fits in a cleanup
Run it first, before anything that compares or counts. The Duplicate Paragraph Finder and Duplicate Sentence Finder both normalise whitespace internally, but the Paragraph Counter depends on how your blank lines are arranged, so cleaning first gives a more accurate count.
For lists rather than prose, the Remove Duplicate Lines tool pairs naturally with this one — cleaning whitespace first means lines differing only by a trailing space are correctly recognised as duplicates.
Everything runs in your browser, so nothing you paste is transmitted or stored.
Frequently asked questions
Does extra whitespace hurt SEO?
Not directly — HTML collapses consecutive whitespace when rendering, so pages look fine. It matters for character counts in length-limited fields like meta descriptions, and for any tool or export that reads the raw source.
Will it merge my paragraphs into one block?
No. Line breaks are preserved and a single blank line between paragraphs is kept. Only runs of three or more consecutive blank lines are collapsed.
Should I use one space or two after a full stop?
One. The two-space convention comes from typewriters with monospaced fonts. In proportional fonts it is unnecessary, and in HTML the second space collapses anyway — so it inflates your source without changing anything visible.
Does it remove line breaks?
No, only whitespace around and within lines. If you need text reflowed into a single block, that is a different operation this tool deliberately avoids, since collapsing line structure usually destroys intended formatting.
Is my text uploaded anywhere?
No. The cleanup runs entirely in your browser and nothing is transmitted or stored.