All tools · Text tools

Whitespace Cleaner

Collapse spaces, trim lines, and drop blank rows.

Free to use, no sign-up required. Whitespace Cleaner is one of 198 tools built into Xenition, alongside a chat that can use them for you.

Tidies text that came out of a PDF, email or spreadsheet with doubled spaces, stray tabs, trailing spaces and stacks of blank lines.

How to use Whitespace Cleaner

  1. Paste the messy text into the box.
  2. Read the cleaned version that appears underneath.
  3. Copy it back to where you need it.

How it works

The text is split into lines. On each line every run of whitespace, including tabs and no-break spaces, becomes one space, and the line is trimmed at both ends. Two or more blank lines in a row are reduced to one, so paragraph breaks survive, and blank lines at the very start and end are removed.

Example

A line reading “ Hello world ”, two blank lines, then a line that starts with a tab and has two tabs between “second” and “line” becomes “Hello world”, one blank line, and “second line”.

Questions about Whitespace Cleaner

Will it join my lines into one paragraph?

No. Line breaks are kept and only blank lines are collapsed. To merge lines into a single line, a line-break remover is the right tool.

Does it remove indentation from code?

Yes. Every line is trimmed, so leading spaces and tabs are gone. Do not run code or YAML through it if its indentation matters.

Use it from chat

You do not have to open Whitespace Cleaner to use it. Ask Xenition in plain language and it runs the right tool, then carries the answer into whatever you are working on — a document, a spreadsheet, a deck.

Related tools