Whitespace Remover

Strip all whitespace, collapse spaces or replace whitespace with any character.

Five quick whitespace operations in one tool: remove all whitespace, drop only tabs, drop only newlines, collapse multiple whitespace into a single space, or replace any whitespace with a custom character (great for slug-style output).

Common use cases

  • Strip whitespace from a copied password before pasting
  • Compact text for one-line shell snippets
  • Replace spaces with hyphens to build URL slugs
  • Remove invisible whitespace before parsing JSON or CSV

Frequently asked questions

What counts as whitespace?
Any character matched by JavaScript's \s regex: space, tab, newline, carriage return, form feed, vertical tab, plus various Unicode whitespace like non-breaking space.
Does 'collapse' affect leading whitespace?
Yes — collapse mode replaces all whitespace runs with a single space and trims leading/trailing whitespace from the whole string.
Can I replace with a multi-char string?
Yes — the 'replace with' field takes any string, including emoji or multiple characters.

Related tools