Boneyard Tools

Remove Extra Spaces From Text

Paste messy text and this tool tidies the spacing for you. By default it collapses any run of spaces and tabs into a single space and trims the whitespace from the start and end of every line. Two more switches let you drop blank lines entirely or shrink oversized paragraph gaps down to one, and the cleaned result is ready to copy or download.

How to remove extra spaces

  1. Paste your text into the Your text box at the top.
  2. Leave Collapse extra spaces on to squeeze doubled spaces and tabs into one.
  3. Leave Trim each line on to strip leading and trailing whitespace per line.
  4. Optionally turn on Remove blank lines to delete empty lines, or Collapse blank lines to keep just one.
  5. Read the cleaned output in the Result box below.
  6. Click Copy or Download to save the tidied text.

Examples

Collapse double spaces and trim lines (defaults)

  Hello    world  
  This   has   gaps 
Hello world
This has gaps

Collapse blank lines to a single gap

Alpha



Beta
Alpha

Beta

Remove blank lines entirely

one

  
two

three
one
two
three

Frequently asked questions

What counts as an extra space?

Any run of two or more spaces or tabs is treated as extra. Collapsing turns each run into a single space, so words stay separated but the doubled-up gaps disappear. A single space between words is left untouched.

Does it remove tabs as well as spaces?

Yes. Tabs are treated as whitespace throughout. Collapsing replaces a mixed run of spaces and tabs with one space, and Trim each line strips both spaces and tabs from the two ends of every line.

What is the difference between Remove blank lines and Collapse blank lines?

Remove blank lines deletes every empty line so the text has no gaps at all. Collapse blank lines keeps paragraph breaks but shrinks any stack of three or more newlines down to a single blank line. The two are mutually exclusive, so turning on Remove blank lines disables the collapse option.

In what order do the options run?

Line endings are normalized to a single style first, then spaces collapse, then each line is trimmed, then blank lines are removed if chosen, and finally blank lines are collapsed. That fixed order means trimming happens after collapsing, so a line of only spaces becomes truly empty and can then be dropped.

Will my line breaks be kept?

Yes. Line breaks stay in place unless you choose to remove or collapse blank lines. Only the whitespace inside and around each line is changed, so your paragraph structure survives by default.

Are Windows, Mac, and Unix line endings handled?

Yes. Windows CRLF and classic Mac CR endings are converted to Unix LF before anything else runs, so the output uses one consistent newline style no matter which system produced the text.

Does it change my letters, numbers, or punctuation?

No. Only whitespace is touched. Every letter, digit, symbol, and the order of your words stays exactly as pasted, which makes the tool safe to run on code, addresses, or data you cannot afford to alter.

How is this different from removing line breaks?

This tool cleans spacing while preserving your lines and paragraphs. If you instead want to flatten everything onto a single line, a remove line breaks tool replaces the newlines themselves rather than tidying the spaces around them.

Is my text private, and is there a size limit?

Everything runs in your browser, so nothing is uploaded and your text never leaves your device. There is no fixed length cap; the practical limit is your device's memory, and the character counters above each box update as you paste.

Learn more

Related tools