Whitespace Cleaner
Trim, collapse, or strip whitespace from any text
Everything runs in your browser. Your data never leaves your device.
Related tools
How to use
Paste your text and select a cleaning mode. The cleaned output appears on the right instantly. Switch modes freely to see which cleans your text best.
Paste text with unwanted whitespace
Enter or paste any text that has trailing spaces, multiple spaces, or blank lines you want to remove.
Choose a cleaning mode
Trim each line removes leading and trailing spaces per line. Collapse spaces reduces multiple spaces to one. Remove blank lines drops empty lines. Strip all whitespace collapses everything into a single line.
Copy the cleaned result
Click Copy in the output pane header to grab the cleaned text. The original input remains unchanged so you can try different modes.
Examples
Cleaning CSV data copied from a spreadsheet
Copying cells from a spreadsheet often adds trailing spaces that break CSV parsing. Paste the copied text and apply Trim each line to strip trailing spaces from every row before saving or importing.
Compressing a paragraph to a single line
Paste a multi-line paragraph and select Strip all whitespace. The result is a single continuous string — useful when you need to paste prose into a single-line input field or a config value that does not allow newlines.
About this tool
Clean up whitespace in text with four modes: trim leading and trailing spaces from each line, collapse multiple consecutive spaces into one, remove all blank lines, or strip all whitespace into a single space-separated string. Output updates as you type. Useful before sorting, deduplication, or pasting into systems that are sensitive to irregular spacing. Runs in your browser.