Clean

Collapse multiple spaces and fix whitespace inside any text

Collapse multiple consecutive spaces into one and strip leading/trailing spaces from any text.

🛡️ Your rows never leave your browser.
Why Onfyt: Treats non-breaking spaces (U+00A0) as whitespace by default, not as regular characters — the most common source of 'invisible' whitespace that word-count tools and VLOOKUP miss.

Interactive Sample Data

idtext
1Name: Alice Mutua
2 City: Nairobi
3Role: Lead Engineer

How this tool works

Extra whitespace enters text in many ways: copying from PDF documents introduces double-spaces at justification points; HTML copy-paste leaves non-breaking spaces (U+00A0); manual data entry produces inconsistent gaps; and CSV exports from certain tools pad values with trailing spaces that make VLOOKUP fail silently. This tool applies three independent operations that you can combine: 1. **Collapse internal spaces**: any run of two or more consecutive space characters within a line is replaced by a single space. 2. **Trim line edges**: leading and trailing spaces are removed from every line. 3. **Normalise Unicode whitespace**: non-breaking spaces (U+00A0), en-spaces (U+2002), em-spaces (U+2003), and other Unicode whitespace variants are converted to standard ASCII spaces before collapsing. Tabs are separate from spaces. By default, tabs are left unchanged. Add 'convert tabs to spaces' to replace each tab with a single space before collapsing. All cleaning runs inside your browser tab — no server involved.

Things that usually go wrong

  • Intentional multiple spaces used for alignment (code comments, ASCII tables) will be destroyed — this tool is for prose and data, not formatted code.
  • Python indentation uses spaces — pasting source code and removing extra spaces will corrupt the indentation.
  • A zero-width space (U+200B) is not a space character — it will not be matched by standard space rules. Use 'Remove Special Characters' to target zero-width spaces.

Edge cases we tested

🧪 Non-breaking space between words (copied from a website)

U+00A0 converted to standard space, then collapsed with adjacent spaces if any.

🧪 Tab-separated values when 'convert tabs to spaces' is added

Each tab replaced with one space; result collapsed to single spaces.

🧪 Multiple blank lines between paragraphs

The blank lines themselves are not removed — only spaces within lines are affected. Use 'Remove Empty Lines' to also clean blanks.

🧪 Alignment spaces deliberately used in a table ('Name | Role | City')

Collapsed — this tool is destructive to ASCII-art table alignment. Do not use on intentionally aligned text.

🧪 Line containing only spaces

Trimmed to an empty line (zero characters).

Frequently Asked Questions

Will this affect spaces inside quoted CSV cells?

This tool works on raw text lines, not on CSV structure. It will modify spaces inside quoted cells the same as spaces outside them. For CSV-aware space trimming, use 'Trim Whitespace'.

Can I trim spaces from a CSV column specifically?

Yes — paste the CSV and add 'trim whitespace in the [column name] column' to your instruction.

Does it change the number of lines?

No — only characters within lines are changed. To remove blank lines, use 'Remove Empty Lines'.

What about tabs inside lines?

Tabs are left unchanged unless you add 'convert tabs to spaces' to your instruction.

Related tools

Clean

Remove Empty Lines

Remove all blank and whitespace-only lines from any block of text.

Open Tool →
Clean

Remove Duplicate Lines

Remove repeated lines from any text block, with options for case sensitivity and whitespace handling.

Open Tool →
Clean

Trim Whitespace

Clean up accidental leading, trailing, and duplicate spaces across all columns in your spreadsheet.

Open Tool →
Clean

Remove Special Characters

Strip invisible control characters, non-ASCII symbols, smart quotes, and unwanted punctuation from spreadsheet cells.

Open Tool →