Collapse repeated spaces, strip trailing whitespace and tidy blank lines.
Paste some text to tidy its whitespace.
Double-spaced sentences
Collapsed to single spaces
Paste the textTrailing whitespace
Invisible but real
Paste code or dataToo many blank lines
Reduced to one
Paste a spaced-out documentAnything with untidy spacing.
Each rule is a separate switch.
The count of characters removed is shown.
Collapsing spaces, trimming line ends and removing blank lines are different jobs. Bundling them into one button means always getting more than you asked for.
Non-breaking spaces and tabs look identical to ordinary spaces and break comparisons, sorting and search. They are handled explicitly.
Collapsing horizontal whitespace never eats a line break, so a document keeps its shape unless you ask otherwise.
Clean the whitespace out of text without touching anything else. Repeated spaces collapse to one, trailing spaces at the end of lines disappear, leading indentation goes if you want it to, and runs of blank lines can be reduced to a single break or removed entirely. Each is a separate switch, because "tidy the whitespace" means different things depending on whether you are cleaning up a pasted document or normalising data. Tabs and non-breaking spaces — the invisible character that breaks so many comparisons — are handled too.
Keep going
Related pages in Text Tools, plus what others are using right now.
More text tools that pair well with this one.
Turn a broken-up block of text into continuous paragraphs.
Replace text across a document, with optional regular expressions.
Compare two pieces of text and see exactly what changed, line by line.
Remove duplicate lines while keeping the original order, with statistics.
Sort lines alphabetically, numerically or by length, in either direction.
Count words, characters, sentences and paragraphs as you type.
Create strong random passwords with full control over length and characters.
Format, validate and minify JSON, with errors that point to the exact line.
Work out any percentage — of a number, as a share, or as a change.
Convert between length, weight, temperature, volume, speed, data and more.
Find the mean, median, mode and range of a list of numbers, with the working shown.
See how savings grow with compounding, including regular contributions.
Sample and population standard deviation and variance, both shown, with the working.
Turn a logo into favicon.ico, the PNG sizes a site needs, and the HTML to declare them.
Check a downloaded file against its published checksum, without uploading anything.
Stamp text like DRAFT or CONFIDENTIAL across a PDF, in your browser.
Turn JSON into readable YAML, with quoting and multiline strings handled properly.
Escape text for HTML, or turn entities back into readable characters.