ToolsEdit PDFArticlesPricingContact
TryPDFKit
Documents tool

Remove Extra Spaces from Text

Tidy messy text by removing double spaces, tabs, odd gaps and surplus blank lines. Choose what to fix. Your text is cleaned on your device and never uploaded.

  • 3 free uses, no sign-up
  • 5 clean-up options
  • Fixes PDF line breaks
  • Text stays on your device
Text
How was Remove extra spaces?
Be the first to rate this tool.
1How it works

Remove extra spaces in three steps

  1. 01

    Paste your text

    Paste the messy text, or open a .txt or similar file.

  2. 02

    Choose the clean-up

    Trim line ends, turn tabs into spaces, remove spaces before punctuation, decide what happens to blank lines, and join broken lines.

  3. 03

    Copy the clean text

    The note says how many characters were removed.

2The details

What you get, and what to know

What you get

  • Double spaces goneRuns of spaces become one. Unusual space characters, such as non-breaking spaces, become normal ones.
  • Invisible characters removedZero-width characters that sneak in from web pages are deleted.
  • Punctuation spacingRemoves spaces before , . ; : ! ? and closing brackets, and after opening brackets.
  • Blank line controlKeep them, allow at most one in a row, or remove all.
  • Join broken linesText copied from a PDF with a line break on every line is turned back into paragraphs.

Good to know

  • French and some other typographyFrench puts a space before : ; ! and ?. Turn off the punctuation option for such text.
  • Code and tablesDo not run it on code, poetry or aligned columns, where spacing carries meaning.
  • Joining lines is a guessJoined lines are separated by blank lines into paragraphs. Check the result if your text has lists or headings.
3Use cases

When people use Remove extra spaces

Clean an email draft

Fix spacing that appeared after pasting from several places.

Fix text copied from a PDF

Rebuild paragraphs from hard-wrapped lines.

Prepare web content

Remove hidden characters and double spaces before publishing.

Normalize data

Trim cells before matching or importing.

Typical spacing problems

Double spaces after full stops, a tab at the start of a line, and lines that break in the middle of sentences are the most common issues. They come from old typing habits, from copying out of PDFs, and from web pages that use hidden characters.

Fixing them makes text easier to read and avoids surprises in other tools, such as a duplicate that is only different by a trailing space.

Which option for which problem

Match the setting to the symptom:

  • Lines that stop mid-sentence: tick Join broken lines into paragraphs.
  • Too many empty lines: set Empty lines to At most one in a row.
  • Spaces before commas: leave Remove spaces before , . ; : ! ? on.
  • Indented lines: leave Trim spaces at the start and end of lines on.

More text clean-ups

Next, you might want Remove duplicate lines, the text sorter or the word counter.

4FAQ

Questions, answered

How do I remove extra spaces from text?+

Paste it here and the default options remove double spaces, trim lines and tidy blank lines.

Is my text uploaded?+

No. It is cleaned in your browser.

How do I fix text copied from a PDF?+

Tick Join broken lines into paragraphs. Lines are merged and paragraphs stay separated by a blank line.

Will it remove non-breaking spaces?+

Yes. They are turned into normal spaces.

Can it remove all blank lines?+

Yes. Set Empty lines to Remove all.

Does it run on phones?+

Yes. Use it in a mobile browser or on a Mac or Windows computer.

+Keep going

Related tools