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.