OnlineNotes Logo

    Remove Extra Spaces

    Turn double spaces and tabs into one space, trim the ends of lines and close up runs of blank lines. Line breaks stay where they are.

    Options

    About this tool

    Extra spaces come from two-space typing habits, justified PDF text, tables pasted into a document and web pages. They are hard to see, and they break things: a column in a spreadsheet stops matching, a form field rejects the value, a published post shows uneven gaps.

    This tool also catches non-breaking spaces, which look like normal spaces but are a different character and survive a normal search for a space. They come along with text copied from web pages. Every one becomes a plain space.

    How it works

    1. Paste the text into the input box.
    2. Each run of spaces, tabs and non-breaking spaces becomes a single space.
    3. If the options are on, spaces at line ends are removed and blank lines are reduced to one.
    4. Copy the result. The counts show how many characters were removed.

    Worked example

    Input

      One   two	 three  
    
    
    four

    Output

    One two three
    
    four

    Spaces and tabs collapse to one space, the line ends are trimmed and the three line breaks become one blank line.

    Edge cases and limits

    • Indentation is removed when trimming is on, so turn it off for code, or use a formatter for that language.
    • Tabs become spaces, so tab-separated data from a spreadsheet loses its columns.
    • It does not add a missing space, such as after a comma.

    Frequently asked questions

    How do I remove double spaces after a full stop?

    Paste the text here. Every run of spaces becomes one, including the ones after a full stop.

    Does it remove line breaks too?

    No. Line breaks stay. Only blank lines are reduced. To join lines into one block, use the remove line breaks tool.

    What is a non-breaking space?

    It is a space character that stops a line from wrapping at that point. It looks like a normal space, so it causes mismatches in searches and spreadsheets. This tool replaces it with a normal space.

    Related tools