Skip to content
Devtoolry

Remove Extra Spaces

Remove extra spaces from text online: collapse repeated spaces and tabs, trim every line and squeeze blank lines. Clean pasted text in one click.

Runs in your browser · Nothing uploaded · No sign-up

Something not working, or missing a feature? Send feedback

About the Remove Extra Spaces

The Remove Extra Spaces tool cleans up whitespace in pasted text: it collapses repeated spaces and tabs into one, trims the start and end of every line and squeezes runs of blank lines. It is handy for text from PDFs, spreadsheets and web pages, and for tidying content before you paste it into a CMS.

Everything runs in your browser, so your input is never uploaded to a server.

How to use the Remove Extra Spaces

  1. Paste your text into the input editor.
  2. Keep "Collapse repeated spaces and tabs" and "Trim each line" on for a standard clean-up.
  3. Choose what happens to blank lines (keep, collapse to one, or remove all), then copy or download the result.

Examples

Clean pasted text

Input

  Hello    world  



Second   line 

Result

Hello world

Second line

Repeated spaces collapse to one, each line is trimmed and the three blank lines shrink to one.

Remove blank lines as well

Input

  Hello    world  



Second   line 

Result

Hello world
Second line

Common mistakes

  • Indented code. Collapsing spaces and trimming lines also removes indentation. Do not run source code or YAML through this tool; use a formatter instead.

Works well with the Remove Extra Spaces

Frequently asked questions

How do I remove double spaces?

Leave "Collapse repeated spaces and tabs" on. Every run of two or more spaces or tabs, including non-breaking spaces, becomes a single space.

Does it remove blank lines?

It can. Set "Blank lines" to "Remove all" to delete them, or "Collapse to one" to keep a single blank line between paragraphs.

Does it change the words or punctuation?

No. Only whitespace is changed: letters, numbers and punctuation stay exactly as you pasted them.