Remove Extra Spaces and Whitespace

Remove extra spaces, tabs and blank lines from text online free. Also strips the no-break and zero-width characters pasted from Word, PDFs and spreadsheets — in your browser.

Runs in your browserNothing uploadedFree · no signup

Line breaks are always normalised so every option below works per line; a Windows or old Mac ending becomes a single newline. Nothing but whitespace is ever changed — your words, punctuation and capitalisation are copied through exactly. Need to join the lines into one paragraph instead? Use Remove Line Breaks.

Frequently asked questions

Why do my double spaces survive every other 'remove extra spaces' tool?
Because the gaps are almost certainly not spaces. Text copied out of Word, a PDF, a web page or a spreadsheet column is full of no-break spaces (U+00A0), em spaces, figure spaces and narrow no-break spaces — characters that look exactly like a space but are not one. A tool that runs a plain find-and-replace on the space character walks straight past them and reports that nothing was found, which sends you looking for the problem somewhere else. This tool converts all sixteen of those characters to an ordinary space first, and only then collapses the runs, so the gap you can see is the gap that gets fixed. It also names what it found, so you can see that the reason your CSV column would not parse was four no-break spaces.
How do I remove all the spaces from a piece of text?
Set 'Extra spaces and tabs' to 'Remove all spaces'. Every space and tab goes, including the single ones between words, so 'h e l l o w o r l d' becomes 'helloworld'. Line breaks are kept, so a list stays a list — each line just loses its internal spacing. The default setting, 'Collapse to one space', is the one you want for ordinary prose: it turns any run of spaces and tabs into a single space and leaves the text readable.
What are zero-width characters and why would my text have them?
They are characters with no width at all, so they are completely invisible on screen while still counting toward your character limit and breaking exact-match searches. The common ones are the zero-width space (U+200B), the byte-order mark (U+FEFF) that a badly saved UTF-8 file leaves at the start, the soft hyphen (U+00AD) that a PDF inserts where a word was split across lines, and the left-to-right and right-to-left marks. They arrive by copy-paste and they are why a password, a product code or a search term that looks identical to the one you expect refuses to match. This tool deletes them rather than turning them into spaces — a zero-width space inside a word is a line-break hint, not a gap, so replacing it with a space would break the word in two.
Will cleaning invisible characters break emoji or Hindi and Arabic text?
Not with the default settings, and this is where most 'remove invisible characters' tools do real damage. The zero-width joiner (U+200D) and non-joiner (U+200C) are invisible, so tools that sweep up everything invisible delete them too — but they carry meaning. A family emoji is several separate emoji held together by joiners, so deleting them shatters one picture into three. In Devanagari and Perso-Arabic scripts they control whether a conjunct renders as a ligature or a half-form, so removing them silently corrupts Hindi, Arabic and Persian text. Here they are left alone unless you tick the separate box that says so.
Can it clean up blank lines and indentation as well?
Yes, and both are separate controls. 'Blank lines' either collapses a run of empty lines down to the single blank line that reads as a paragraph break, removes them all to close a list up, or leaves them alone; blank lines at the very start and end are dropped either way, since an empty first line is not a paragraph break. 'Trim spaces at the start and end of each line' strips the leading and trailing whitespace that makes a pasted list look ragged. A line holding nothing but spaces or a no-break space counts as blank.
Is my text uploaded anywhere?
No. Everything runs entirely in your browser and nothing is sent to a server, so a document, a customer list or a password you are checking for stray characters never leaves your device.