Skip to main content

Fix Spacing

Remove extra spaces and fix line breaks.

Feedback

Key Features

  • Collapses multiple spaces into single spaces
  • Reduces excessive newlines (3+ enters) to standard paragraph spacing
  • Trims trailing and leading whitespace
  • Standardizes paragraph breaks

Benefits

  • Fix bad formatting from PDF copy-pastes
  • Clean up accidental double-tapping on spacebar
  • Make text layout consistent and professional
  • Prepare copy for publishing

How to use this tool

Paste your messy text with weird gaps

Process with the tool

Get perfectly spaced, tidy text

Spacing errors are invisible until they are published

Spacing problems are the least noticed and most persistent defects in a document, because the eye reads words rather than gaps. A double space between sentences, a space before a comma, a missing space after a full stop: all of these survive proofreading and all of them are visible the moment the text is set in a different font or a narrower column.

They arrive from specific places. Copying from a PDF introduces spaces where the layout had line breaks. Deleting a word by hand leaves the spaces on both sides of it. Pasting between applications converts one space convention to another. Text assembled from multiple sources carries each source's habits, so a single document ends up with several conventions at once, which is more noticeable than any one of them consistently applied.

The rules worth applying are boring and mechanical. One space between words. One space after a sentence-ending punctuation mark, since the two-space convention belongs to typewriters and looks like a gap in proportional type. No space before a comma, full stop, colon, semicolon, question mark or closing bracket. One space after them. No space immediately inside brackets or quotation marks.

French typography is the deliberate exception and it is worth knowing before you normalise a bilingual document. French sets a space before the colon, semicolon, question mark and exclamation mark, and it should be a narrow no-break space rather than an ordinary one. A rule written for English will strip those and produce text that looks wrong to a French reader, so a mixed document needs handling per language rather than in one pass.

Trailing whitespace at the end of lines is invisible in every editor that does not deliberately show it, and it matters in exactly two places: in Markdown, where two trailing spaces mean a line break, and in version control, where it produces diff noise on lines nobody edited. Removing it is safe for prose and worth a glance in anything else.

The pass runs in your browser, which is the usual point: the document being tidied is nearly always a draft, and a draft is the thing you least want on someone else's server.

Frequently Asked Questions

Will this merge all my paragraphs?

No, it preserves distinct paragraphs (double line breaks) but removes excessive gaps (triple or quadruple line breaks).

Related tools

Need this in a script?

The same tool answers on HTTP. Free, 1,000 calls a day, no card, and one token works across every Astral API.

POST https://astraltext.com/api/v1/fix-spacing

Fix spacing APIGet a free token