Normalize whitespace in text
Tidy up all the whitespace in one go: runs of spaces become one, tabs and non-breaking spaces become plain spaces, each line is trimmed and long runs of blank lines become a single paragraph break. Everything happens in your browser and nothing is uploaded.
How it works
-
Paste your text
Type or paste the text in the left box, or open a .txt file. No text to hand? Click Example.
-
Instant result
The result appears as you type. Change the options and see straight away what changes.
-
Copy or download
Copy the result with one click, save it as a file or use it as input for a next step.
Example
First line with tabs, then three blank lines and Second line with a hard space becomes the two lines First line with tabs and Second line with a hard space, separated by one blank line.
Keep paragraphs or not
- Keep lines and paragraphs (default): line breaks stay, and any run of more than one blank line is reduced to one.
- Unticked: every bit of whitespace, including line breaks, becomes a single space, so a whole text becomes one line.
Good for
- Text from PDFs, e-mails and web pages, where all kinds of space characters creep in.
- Prepping text for comparison, so differences in spacing do not show up as differences in the text. See compare text.
- Content that goes into a CMS or a database field, where odd spacing looks broken.
For one specific kind of clean-up you may prefer a narrower tool: remove double spaces or remove whitespace.
Frequently asked questions
How is this different from removing double spaces?
It does more in one step: it also trims every line, turns tabs and non-breaking spaces into plain spaces, and collapses three or more blank lines into one paragraph break. [Remove double spaces](/en/text/remove-double-spaces) only collapses runs of spaces.
What does "Keep lines and paragraphs" do?
Ticked, line breaks and paragraph breaks stay (several blank lines become a single one). Unticked, all whitespace becomes single spaces and the text turns into one line.
Is leading indentation kept?
No. Leading spaces are trimmed with every line, so indented code loses its indentation. For code use [spaces to tabs](/en/text/spaces-to-tabs) or [tabs to spaces](/en/text/tabs-to-spaces) instead.
Does the text change in any other way?
No. Words, punctuation and letter case stay exactly as typed.