Boneyard Tools

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

  1. Paste your text into the box.
  2. Tick the options you need, such as collapse spaces, trim lines, or remove blank lines.
  3. 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