Collapse multiple spaces and fix whitespace inside any text
Collapse multiple consecutive spaces into one and strip leading/trailing spaces from any text.
Interactive Sample Data
| id | text |
|---|---|
| 1 | Name: Alice Mutua |
| 2 | City: Nairobi |
| 3 | Role: Lead Engineer |
How this tool works
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
U+00A0 converted to standard space, then collapsed with adjacent spaces if any.
Each tab replaced with one space; result collapsed to single spaces.
The blank lines themselves are not removed — only spaces within lines are affected. Use 'Remove Empty Lines' to also clean blanks.
Collapsed — this tool is destructive to ASCII-art table alignment. Do not use on intentionally aligned text.
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
Remove Empty Lines
Remove all blank and whitespace-only lines from any block of text.
Open Tool →Remove Duplicate Lines
Remove repeated lines from any text block, with options for case sensitivity and whitespace handling.
Open Tool →Trim Whitespace
Clean up accidental leading, trailing, and duplicate spaces across all columns in your spreadsheet.
Open Tool →Remove Special Characters
Strip invisible control characters, non-ASCII symbols, smart quotes, and unwanted punctuation from spreadsheet cells.
Open Tool →