Skip to content

Whitespace RemoverBeta

Trim lines, collapse repeated spaces, delete empty lines, convert tabs and remove line breaks, exactly the way you need. Your text stays in your browser.

0 characters · 0 lines

Lines

Spaces

0 characters · 0 lines

How to use

Paste your text into the box and turn on whichever checkboxes below match what you need — the result keeps updating as you edit. You can enable several options at once; whatever order you check them in, they’re applied in a fixed order (see “Order of operations” below). Copy the result with the button next to it.

Cleanup options

  • Trim each line: removes leading and trailing spaces and tabs from every line, without touching whitespace in the middle of a line.
  • Collapse multiple spaces into one: shrinks runs of two or more spaces down to one. Tabs and line breaks aren’t affected.
  • Remove all spaces and tabs: strips out every remaining space and tab. Line breaks are left alone.
  • Remove empty lines: deletes lines that have no content, or only whitespace.
  • Convert tabs to spaces: replaces each tab character with a single space. If the tabs were being used to line up columns like a table, this can throw off the alignment.
  • Normalize non-breaking and full-width spaces: converts the non-breaking space (U+00A0) and the full-width space (U+3000, a wide space common in CJK input methods) into a regular space (U+0020).
  • Remove line breaks: joins every line into one. You can choose whether lines are joined with a space or with nothing at all.

Order of operations

When several options are on, they’re applied in this order: normalize special spaces → convert tabs → trim each line → remove empty lines → remove line breaks → collapse multiple spaces → remove all spaces. Collapsing runs of spaces happens after line breaks are removed, so any extra spaces created where lines get joined are cleaned up too.

Privacy

Your text is processed inside this browser only. It is not saved or sent anywhere, and it disappears when you close the page.

Frequently asked questions

What happens if I turn on both 'Collapse multiple spaces' and 'Remove all spaces and tabs'?

Runs of spaces are first collapsed to one space, and then that remaining space is removed too — so the result ends up the same as turning on only 'Remove all spaces and tabs'. Having both on doesn't cause an error, but normally you only need one of the two.

Why are the full-width space (U+3000) and the non-breaking space (U+00A0) handled separately?

Both characters usually look just like a regular space (U+0020) on screen, but the computer treats them as different characters. The full-width space often comes from Japanese/Chinese input methods, and the non-breaking space frequently sneaks in when you paste text copied from a web page. If they're left in, you can end up with issues like 'I removed the spaces but the character count didn't drop' or 'this looks identical but search doesn't find it', so there's a dedicated option to normalize them to a regular space.

When should I join lines with a space versus joining them with nothing?

Use 'Join with a space' when you're merging a sentence that was wrapped across several lines back into one paragraph — otherwise the words on either side of the line break would run together. Use 'Join with nothing' for content that's meant to be glued together without any space, such as a vertically listed number or a code fragment split across lines.