Remove Extra Spaces
Collapse multiple spaces and tabs down to a single space, trim leading and trailing whitespace from each line, or strip every whitespace character outright. Toggle each behaviour to match what your text needs.
How to use
- 1
Paste your text
Drop text with double spaces, tab indentation, or trailing whitespace.
- 2
Pick the toggles
Collapse runs of whitespace to a single space, trim each line's edges, or go nuclear and remove every whitespace character.
- 3
Clean
Click Clean spaces. The result appears in the output box and stays until you clean again or reset.
- 4
Copy or save
Use Copy to put the result on your clipboard, or Save to download cleaned.txt.
Common use cases
- Tidy text pasted from a PDF that introduced double spaces between every word.
- Strip trailing whitespace from code before committing.
- Prepare a slug-like compact string by removing all whitespace.
- Normalise space-separated tokens in a CSV before import.
Limitations
- Collapse preserves newlines so paragraph breaks survive — only horizontal whitespace is collapsed.
- Trim each line's edges removes leading and trailing whitespace on every line, including tab indentation.
- Remove all whitespace ignores the other toggles and strips every space, tab and newline.
- Inputs larger than 1 MB are flagged but still processed on the main thread.
Frequently asked questions
Related tools
View allRemove Empty Lines
Strip blank lines from text instantly.
Text Cleaner
Clean text by removing extra spaces, empty lines and special characters.
Remove Duplicate Lines
Remove duplicate lines from a list, case-sensitive or not.
Sort Lines
Sort lines alphabetically, numerically or in reverse.