Skip to main content

Text Formatter

Trim, normalize, and tidy up text with togglable formatting rules.

Written by Golam Rabbani, Founder & Lead Engineer

Formatting rules

How to use this text formatter

  1. Paste your messy text into the "Input text" field.
  2. Toggle the formatting rules you want — trim lines, collapse spaces, collapse blank lines, normalize line endings, strip trailing whitespace, or remove leading/trailing blank lines.
  3. Press Format to apply all selected rules to your text in one pass.
  4. Press Copy output to copy the cleaned text to your clipboard.
  5. Press Reset to clear the field and start over.

About this text formatter

The text formatter is a deterministic whitespace cleaner. It runs every selected rule in a fixed order — normalize line endings, trim or strip trailing whitespace per line, collapse multi-space runs, collapse multi-blank-line runs, then drop leading/trailing blank lines — so the output is identical no matter how many times you re-run it on the same input.

A concrete example. Paste this 4-line block (with two trailing spaces on line 2 and a Windows CRLF on line 3):

` Hello\n World \r\n\n\nGoodbye `

With every rule enabled the formatter normalizes the CRLF to `\n`, trims each line, collapses the double blank line, and removes the trailing blank line, producing:

`Hello\nWorld\nGoodbye`

Every rule is purely text-level — no semantic parsing, no Markdown or HTML awareness — so it is safe to run on log files, plain notes, CSV rows, or pasted email signatures without accidentally rewriting their structure. The whole pipeline runs in your browser, so nothing you paste leaves your machine.

FAQ

Does the text formatter change my text's meaning?
No. Every rule is a whitespace or line-ending transformation. The order of words, punctuation, and content is never modified — only the spaces, tabs, and newlines around them are normalized.
What does "normalize line endings" do?
It converts Windows-style CRLF (`\r\n`) and old Mac-style CR (`\r`) line endings to plain LF (`\n`). This is useful when text pasted from Windows apps shows up as a single long line on macOS or Linux.
Will it collapse spaces inside a sentence?
Yes. When "Collapse multiple spaces" is enabled, any run of two or more spaces or tabs inside a line is replaced with a single space. Single spaces between words are preserved.
Why are leading blank lines removed by default?
Text pasted from PDFs or emails often arrives with one or two empty lines at the top. The default removes them so the output starts on the first non-empty line, which is almost always what you want.
Is there a size limit on the input?
No hard limit is enforced. The formatter runs as a single pass over the string in your browser, so performance stays smooth for documents up to several megabytes of plain text.
Is my text uploaded anywhere?
No. Everything runs locally in your browser. The tool never sends your text to a server, and nothing is logged or stored after you close the tab.