Boneyard Tools

Remove Extra Whitespace From Text

Paste text riddled with double spaces, stray tabs, ragged indentation or empty lines and clean it up in one pass. Toggle the exact fixes you want: collapse repeated spaces, strip every space and tab, trim each line, remove blank lines, or trim the whole block. The result updates instantly with a live character count so you can copy the tidy text straight out.

How to remove extra whitespace

  1. Paste or type your text into the Your text box.
  2. Turn on Collapse extra spaces to squeeze repeated spaces and tabs into one, or Remove all spaces and tabs to delete them entirely.
  3. Turn on Trim each line to clean the ends of every line, and Remove blank lines to drop empty rows.
  4. Optionally turn on Trim whole text to strip whitespace from the very start and end.
  5. Read the cleaned Result, check the character count, and click Copy.

Examples

Collapse spaces and trim lines (default options)

  Hello    world  

  Tidy   text 
Hello world

Tidy text

Also remove blank lines

line one


line two
line one
line two

Remove all spaces and tabs

a b c
d e
abc
de

Frequently asked questions

What is the difference between collapse spaces and remove all spaces?

Collapse extra spaces turns each run of spaces or tabs into a single space, keeping words readable and separated. Remove all spaces and tabs deletes every space and tab, so words run together with no gaps. Remove all spaces overrides collapse when both are ticked, and it disables the collapse box in the interface.

In what order are the options applied?

The tool first normalizes line endings, then handles spaces (remove all, or collapse), then trims each line, then removes blank lines, and finally trims the whole string. That fixed order means, for example, that lines are trimmed before blank lines are detected, so a line of only spaces counts as blank and gets dropped.

What does trim each line do versus trim whole text?

Trim each line removes leading and trailing spaces and tabs from every individual line while keeping the line breaks intact, which fixes indentation and trailing padding. Trim whole text only strips whitespace from the very beginning and end of the entire block, leaving the interior untouched.

How do I remove blank lines?

Turn on Remove blank lines. Any line that is empty, or that contains only spaces and tabs, is dropped and the surrounding lines close up with no gap between them. This is useful for tightening up double-spaced paragraphs or list output.

Does it treat tabs the same as spaces?

Yes. Both spaces and tab characters are treated as whitespace. Collapse and remove-all act on runs that mix spaces and tabs, and trimming clears tabs from the ends of lines just as it clears spaces.

Are Windows, Mac and Unix line endings supported?

Yes. Windows CRLF, classic Mac CR and Unix LF endings are all normalized to plain line breaks before any cleanup runs, so the output is consistent no matter what platform produced the text.

Is there a size limit on the text?

There is no fixed limit. Everything runs in your browser, so the practical ceiling is your device's memory. Even large pastes clean almost instantly because the operations are simple find-and-replace passes.

Will it change my letters, numbers or punctuation?

No. Only whitespace is affected. Letters, digits, punctuation, symbols and capitalization are left exactly as you pasted them, and line breaks are preserved unless you remove blank lines.

Is my text private?

Yes. All processing happens locally in your browser and nothing is uploaded to any server, so sensitive or confidential text never leaves your device.

Learn more

Related tools