Remove Extra Spaces

Clean up text copied from PDFs, emails, spreadsheets or web pages. This tool collapses repeated spaces, trims the ends of lines and tidies line breaks — without merging your paragraphs together.

Remove Extra Spaces

Processed in your browser

The number of characters removed will be shown here.

How to remove extra spaces

  1. Paste the messy text — from a PDF, an email thread, a spreadsheet cell or a web page.
  2. Check the options. The defaults fix spacing while keeping your paragraphs exactly where they were. Tick Join broken lines only if every line of a paragraph has been split, which is typical of text copied from PDFs.
  3. Copy or download the clean version. The note under the result tells you how many characters were removed.

What this tool does

Extra whitespace is one of the most common problems with copied text. It makes documents look uneven, breaks search-and-replace, causes duplicate entries in lists, and can push text over a character limit without you noticing. This tool removes it in four targeted ways:

  • Collapse repeated spaces and tabs — any run of spaces, tabs or non-breaking spaces inside a line becomes a single normal space.
  • Trim lines — spaces at the beginning and end of each line are removed. These are invisible but often break alignment and matching.
  • Limit blank lines — three or four empty lines in a row become one, so paragraphs stay separated but the gaps are consistent. Windows-style line endings are normalised at the same time.
  • Join broken lines (optional) — within each paragraph, single line breaks are replaced with spaces, turning "hard-wrapped" PDF text back into flowing paragraphs. Blank lines between paragraphs are always kept.

How paragraphs are preserved

The tool treats a blank line as the boundary between paragraphs. With the default settings, it never removes that boundary, so a five-paragraph email comes out as five paragraphs. When Join broken lines is on, only the line breaks inside each paragraph are merged; if a PDF has joined two paragraphs without any blank line between them, the tool cannot tell they were separate, so check headings and list items afterwards.

Examples

Double spaces after full stops

The meeting is on Monday.  Please bring the report. becomes The meeting is on Monday. Please bring the report.

Text copied from a PDF
Online tools are most useful when they
are fast, private and easy to
understand.

With Join broken lines ticked, this becomes one line: "Online tools are most useful when they are fast, private and easy to understand."

Tips

  • Clean text before counting it. Extra spaces inflate the character count shown by the Character Counter and can split paragraphs in the Word Counter.
  • When de-duplicating a list, collapse spaces first, then use Remove Duplicate Lines — "New  York" and "New York" will then match.
  • For code, be careful: indentation matters in languages such as Python and YAML. Untick Trim and Collapse if you only want to fix blank lines.
  • Need consistent capitalisation too? Follow up with the Case Converter.

Frequently asked questions

Will this remove the spaces between words?

No. Only extra spaces are removed; a single space always remains between words.

Does it remove line breaks?

Not by default. Line breaks and paragraph gaps are kept. Only the optional Join broken lines setting merges line breaks, and it still keeps blank lines between paragraphs.

What is a non-breaking space?

A special space character (often shown as   in HTML) that stops a line from wrapping at that point. It looks identical to a normal space but is a different character, which causes problems when searching or comparing text. The tool converts them to normal spaces.

Is it safe for confidential documents?

Yes. The cleaning runs in your browser and the text is never sent to a server.

Embed this tool on your website

Copy this code and paste it into your page or blog post. It is free to use; please keep the credit link.

Last updated . Spotted a mistake? Let us know and we will correct it.