Remove Extra Whitespace From Text
Paste messy text and clean up the whitespace. Collapse repeated spaces, strip every space and tab, trim each line, or drop blank lines, then copy the tidy result.
How to remove extra whitespace
- Paste your text into the box.
- Tick the options you need, such as collapse spaces, trim lines, or remove blank lines.
- Copy the cleaned text from the result box.
Examples
Collapse double spaces and trim lines
Hello world Tidy text
Hello world Tidy text
Frequently asked questions
What is the difference between collapse spaces and remove all spaces?
Collapse spaces turns each run of spaces or tabs into a single space, keeping words apart. Remove all spaces deletes every space and tab, so words run together. Remove all spaces overrides collapse when both are on.
What does trimming lines do?
Trimming lines removes the leading and trailing spaces and tabs from each line, while keeping the line breaks. It is handy for fixing text that was indented or padded on every row.
How do I remove blank lines?
Turn on remove blank lines and any line that is empty, or holds only spaces and tabs, is dropped. The remaining lines move together with no gaps between them.
Does it handle tabs as well as spaces?
Yes. Tabs are treated as whitespace. Collapse spaces and remove all spaces both act on tabs and spaces, and trimming lines strips tabs from each end.
Are Windows and Mac line endings supported?
Yes. CRLF, CR, and LF line endings are normalized to plain line breaks before the cleanup runs, so output is consistent across platforms.
Is my text private?
Yes. Everything runs in your browser and nothing is uploaded to a server.
Related tools
Remove Line Breaks
Remove line breaks and paragraph breaks from text online. Flatten copied text into one line, keep spaces tidy, then copy the result. Free and private.
Remove Duplicate Lines
Remove duplicate lines from text online and keep the first of each. Options for case sensitivity and trimming whitespace. Free, instant, and private.
Add Line Numbers
Add line numbers to any text online. Set the start value, step, and separator, pad numbers to align, and copy or download the result. Free and private.
Bullet List Maker
Turn lines of text into a bullet or numbered list online. Pick dash, asterisk, dot, arrow or numbers, add indent, then copy. Free and private.
Caesar Cipher
Encode and decode text with the Caesar shift cipher. Pick any shift, see the result live, and brute force all 25 shifts. Runs entirely in your browser.
Case Converter
Convert text between UPPERCASE, lowercase, Title Case, Sentence case, camelCase, PascalCase, snake_case, kebab-case and CONSTANT_CASE. Free and private.