Text Formatter

Paste rough copy and this formatter removes the whitespace damage that creeps in when text travels between Word, PDF, email and the web: ragged leading spaces, double spaces after full stops, stray tabs, blank lines and mixed Windows/Unix line endings. Everything is processed in your browser.

Format text

Formatting options

Tip: press Ctrl+Enter (Cmd+Enter on a Mac) to format, and Tab to move between the controls.

  • 0Words
  • 0Characters
  • 0Lines

What this text formatter actually changes

The tool works line by line, then rejoins the result. Each option is independent, so you can keep paragraph breaks while still killing double spaces — a combination people often need when pasting from a PDF, where line breaks are hard and spacing is inconsistent.

Exactly what each option does to your text
Option What it removes What it never touches
Trim start and end Whitespace before the first character and after the final one. Whitespace inside the text, including deliberate indentation.
Trim every line Spaces and tabs at the start and end of every line. Indentation in the middle of a line and all other characters.
Collapse repeated spaces and tabs Runs of two or more spaces or tabs, which become one space. Single spaces, punctuation and any non-whitespace character.
Remove blank lines Empty lines and lines containing only spaces or tabs. Every line that has any visible content, in its original order.
Join into one paragraph All line breaks; each becomes a space. Word order, punctuation and the relative order of the text.

Line endings are normalised too

Text copied from Windows software often contains CRLF pairs (\r\n), while macOS and Linux use a single \n, and very old Mac software used a bare \r. Mixed endings are why some editors show odd characters or missing breaks. This formatter converts all three to plain \n before doing anything else, so the output is consistent no matter where the input came from.

Where people use it

  • Cleaning text lifted out of a PDF before it goes into a CMS, where hard line breaks would otherwise appear mid-sentence.
  • Tidying a list of email addresses, SKUs or URLs that picked up trailing spaces and now fails an import.
  • Repairing copy pasted from Word, where non-breaking spaces and double spaces are invisible until they break a layout.
  • Preparing plain-text versions of documents for review, diffing or translation.

Nothing here is uploaded. The formatter is JavaScript running in this tab. There is no request back to the server, which is why the page still works if you disable your network connection after it loads.

Frequently asked questions

Does collapsing spaces damage indentation or code?
It can, yes. If you are formatting source code or anything where leading indentation is meaningful, untick Trim every line and Collapse repeated spaces and tabs first, or use the plain duplicate line remover, which leaves interior spacing alone.
Why is my paragraph break gone?
Join into one paragraph is ticked. Untick it and blank lines will survive as paragraph separators.
Is there a size limit?
No server limit applies because nothing is transmitted. The practical ceiling is your browser's memory; text of a few hundred kilobytes formats instantly, and very large inputs simply take a moment longer.
Can I undo?
The input box keeps your original text until you clear it, so copy from there if you need the raw version back. Ctrl+Z inside the input field also works as usual.
How do I remove extra spaces between words?
Leave Collapse repeated spaces and tabs ticked and press Format text. Every run of two or more spaces or tabs becomes a single space. The shortcut button Collapse double spaces does just this one job without touching anything else.
Can I remove line breaks but keep paragraphs?
Yes. Untick Join into one paragraph and leave Remove blank lines off. That keeps your paragraph structure while still trimming each line and collapsing repeated spaces, which is the usual fix for text copied out of a PDF.
Does it fix non-breaking spaces from Word?
The formatter treats non-breaking spaces as whitespace, so they are collapsed and trimmed along with ordinary spaces. That removes the invisible characters that most often break a layout after a paste from Word or Google Docs.