Skip to content
cliplimeClipLime

Remove extra spaces from text

Turn double spaces into single spaces and trim the edges of every line.

0 characters, 0 lines

What to clean up

Spaces and lines

Removes spaces and tabs at the start and end of every line.

Turns any run of spaces and tabs into a single space.

Leaves the spaces at the start of a line alone, for code and outlines. Not available while trimming.

Deletes lines that are empty or hold only spaces.

Keeps a single blank line between paragraphs.

Joins all the lines into one, for text copied from a PDF or an email that was wrapped.

Characters and markup

Removes tags, comments, scripts and styles, and turns entities such as & into characters.

Changes curly single and double quotes and apostrophes to plain ones.

Changes em dashes and en dashes to a plain hyphen.

Changes non breaking spaces and other special spaces to a normal space.

Removes zero width spaces, byte order marks and soft hyphens. Joiners used by emoji and some scripts are kept.

Line breaks in the result are always plain line feeds, whatever the original text used.

Your text stays in your browser. Nothing you type or paste is sent anywhere.

At a glance

What it removes
Runs of spaces and tabs inside a line become one space, and spaces at the start and end of each line are trimmed.
Double spaces
Two spaces after a full stop, a typewriter habit, become one.
Unusual spaces
Non breaking, thin and ideographic spaces are first turned into normal ones, so web copy is cleaned too.
Indentation
To leave leading spaces alone, turn off Trim each line, then turn on Keep indentation.
Line breaks
Not touched. Empty lines and the order of lines stay as they were.
Counted
The summary says how many runs of spaces were collapsed and how many lines were trimmed.
Privacy
Runs in your browser. Your text is never uploaded.

How to do it

  1. 1

    Paste your text

    Type or paste into the box, or load a plain text file.

  2. 2

    Check the switches

    Collapse repeated spaces, Trim each line and Replace unusual spaces are on. For code, turn off Trim each line and turn on Keep indentation.

  3. 3

    Read the summary

    It shows how many runs of spaces were collapsed and how many characters you saved.

  4. 4

    Copy or download

    Press Copy for the clipboard or Download for a text file.

Where extra spaces come from

  • The two spaces after a full stop. A habit from typewriters. Most current style guides, including APA and Chicago, ask for one.
  • Aligned text. Columns lined up with spaces in a PDF, a plain text table or an old document break apart when pasted somewhere else.
  • Spreadsheet and form fields. A name typed with a trailing space looks fine but fails a lookup or a duplicate check.
  • Web pages. Authors use non breaking spaces to control wrapping, and they arrive when you copy.

Spaces that do not look like spaces

Not every blank gap is the plain space character. The non breaking space (U+00A0) is common on web pages, to keep a number and its unit together. There are also thin spaces, figure spaces, narrow no break spaces and the wide ideographic space used in Chinese, Japanese and Korean text. A search for two spaces never finds them, which is why a text that looks clean can still fail a comparison.

This page replaces those with a normal space first, then collapses and trims. One caution: some typography uses them on purpose. French puts a non breaking space, often a narrow one, before a colon, a semicolon, a question mark and an exclamation mark, so turn off Replace unusual spaces when you are cleaning French text that should keep them.

Trim, collapse and keep indentation

  • Collapse works inside a line: 'one two' becomes 'one two'.
  • Trim works at the edges: ' one two ' becomes 'one two'.
  • Keep indentation collapses the spaces inside a line but leaves the ones at the start, so a snippet of code or an outline keeps its shape. It is available only while Trim each line is off.

Tabs count as spaces here, so a tab in the middle of a line becomes a single space. If your text is tab separated data, such as a table copied from a spreadsheet, switch Collapse repeated spaces off, or the columns will merge.

Questions people ask

How do I remove double spaces from text?

Paste it here. Collapse repeated spaces is on, so every run of spaces becomes a single space, including the two spaces after a full stop.

Does it remove spaces at the start of a line?

Yes, with Trim each line on, which is the default here. To keep indentation, turn off Trim each line first, then turn on Keep indentation.

Why do gaps remain after cleaning?

They are probably non breaking spaces or another special space. Make sure Replace unusual spaces is on. If they remain, a zero width character may be involved, which you can remove in the options below the result.

Will it change my tabs?

Tabs inside a line are treated as spaces and become one space. For tab separated data, switch Collapse repeated spaces off.

Will it remove line breaks too?

No, line breaks are not touched. To join lines or delete blank ones, use the switches below the result, or the remove empty lines page.

Is my text uploaded?

No. Everything happens in your browser, and nothing you paste is sent anywhere.

Guides that help

All Text guides →