Dzary Find a tool

Remove Extra Spaces

Collapse double spaces, tabs, hidden characters and stray line breaks in pasted text.

What to clean
0Characters in
0Characters out
0Characters removed
0Lines out

Runs in your browser. Nothing you enter is uploaded or stored.

How to use the extra space remover

  1. Paste your text into the left box. This is often text copied from a PDF, an email, a web page or a chat, where spacing has gone wrong.
  2. Leave the default checks on for a standard clean-up, or tick extra options such as removing the space before punctuation or joining all lines into one paragraph.
  3. Copy the cleaned text from the right. The counters show how many characters were removed, so you can see how much mess there was.

The cleaning happens in your browser as you type, and every option can be changed after the fact, since your original stays in the left box.

What each option does

OptionWhat it fixesBefore → after
Tabs and non-breaking spacesReplaces look-alike spaces that other tools missa⇥b → a b
Zero-width charactersRemoves invisible characters that break searching and matchingwor​d → word
Repeated spacesTurns two or more spaces in a row into onea b → a b
Trim each lineRemoves spaces at the start and end of lines␣␣text␣␣ → text
Space before punctuationPulls punctuation back to the word before itHello , world ! → Hello, world!
Limit empty linesLeaves at most one blank line between paragraphs3 blank lines → 1
Remove all empty linesMakes a tight list with no gapsparagraphs → one line each
Join linesTurns hard line breaks into spaces, for text from PDFsline↵break → line break

Where extra spaces come from

Spacing problems rarely come from the writer. They usually appear when text moves between systems:

  • PDFs and scanned documents insert a line break at the end of every printed line and often add stray spaces around hyphens and justified text.
  • Word processors and web pages use non-breaking spaces (character 160) between numbers and units. They look like ordinary spaces but are not matched by a normal space search.
  • Old typing habits put two spaces after every full stop, which is now treated as an error by most style guides.
  • Copying from tables and chat apps carries tabs, leading spaces, and zero-width characters used by some websites to track or format text.

Worked example

Press Try sample to see a typical mess. The input contains double and triple spaces, a tab, four blank lines in a row, lines that begin and end with spaces, a space before an exclamation mark, a hidden zero-width character and two non-breaking spaces. With the default options, the result is:

This text has too many spaces , and tabs. Lines start and end with spaces Hello world ! Non breaking spaces too.

Spaces and tabs are collapsed, the lines are trimmed, the four blank lines become one, and the hidden character and non-breaking spaces are gone. The space before “,” and “!” remains because that option is off by default, since it can be wrong in French typography, where a space before ? and ! is normal. Tick Remove the space before , . ; : ! ? to fix them. Switching on Join all lines would flatten the three paragraphs into a single line.

Tips for cleaning specific kinds of text

  • Text copied from a PDF: turn on "Join all lines", leave the rest on, then read the result for words broken by a hyphen at a line end.
  • Code or poetry: turn off "Collapse repeated spaces" and "Trim each line", because indentation and spacing are part of the meaning.
  • Email or chat exports: use the default settings and turn on "Remove the space before punctuation" if sentences look loose.
  • Lists for a spreadsheet: turn on "Remove all empty lines" so each entry sits on its own row with no gaps.
  • Text for a form with a character limit: clean first, then check the character counter above to see how many characters you saved.

With the default options, cleaning twice changes nothing more, so you can paste the result back in and try different options. The zero-width joiner and non-joiner characters used in Urdu, Persian and emoji are left alone, because removing them would change the writing.

Accuracy and limits

The tool only changes spacing and line breaks, never letters, numbers or punctuation. Joining lines cannot tell a paragraph break from a line wrap, so use it only on text where every line break is a wrap. Words split with a hyphen at a line end, as in many PDFs, are not rejoined. Characters outside the common space types, such as unusual control characters, are left alone. Tab-separated data is changed by the tab option, so turn that off if you are cleaning a table.

Frequently asked questions

How do I remove double spaces from text?

Paste the text and keep “Collapse repeated spaces into one” ticked. Every run of two or more spaces becomes a single space.

What are non-breaking spaces?

They are space characters (code 160) that stop a line from breaking at that point. They look like normal spaces but are different characters, so many cleaning tools miss them. The first option converts them to ordinary spaces.

How do I fix text copied from a PDF?

Tick “Join all lines into one paragraph” and leave the other defaults on. This removes the line break at the end of every printed line. Check hyphenated words afterwards.

Will it remove spaces inside words or between sentences?

It will reduce several spaces to one, but it never removes the single space between words or after a full stop.

Is my text sent anywhere?

No. The text is cleaned in your browser and is not uploaded or stored.