Skip to the tool

Remove whitespace

MDV Tools

Paste text and get it back with doubled spaces, stray tabs and extra blank lines tidied — or with every space gone, so 1 2 3 4 5 reads 12345.

Runs on this device Works offline
0 characters
Result
paste text above
How this works

Tidy works line by line: whitespace at both ends of a line is removed, every run of whitespace inside it becomes one ordinary space, and a run of blank lines shrinks to a single blank line, with none left at the start or the end. Keep indentation leaves the whitespace before a line's first visible character exactly as typed, tabs included, and tidies only what follows. One line turns every run of whitespace, line breaks included, into one space. No spaces deletes every space and tab but keeps the line breaks, which is what a phone number, an IBAN or a column of digits usually needs. No whitespace deletes the line breaks too. Drop blank lines removes every line that is empty or whitespace-only, in Tidy and No spaces.

Whitespace here is what the JavaScript \s class matches: space, tab, the line breaks, vertical tab, form feed, the no-break space U+00A0, the typographic spaces U+2000–U+200A, U+202F, U+205F, U+3000, U+1680, the line and paragraph separators U+2028/U+2029 and the byte order mark U+FEFF. Anything in that list other than a plain space, tab or line break is counted and named under the result, since those are what survive a find-and-replace of a typed space. Tidy writes them back as U+0020, so a no-break space between a number and its unit becomes a space a line can break at. The zero-width space U+200B, the joiners and the word joiner U+2060 are not whitespace by this definition and pass through untouched. \r\n and a lone \r count as line breaks; if the input held any \r\n, the lines are joined with \r\n again, otherwise with \n.

Input above 2,000,000 characters is refused rather than attempted, so the tab never hangs. Nothing is uploaded: there is no server in this file.

The Dark button remembers its setting in this browser's local storage. Nothing you type or drop into the page is stored.