Skip to content

Text Formatter

Apply only selected line trimming, horizontal whitespace collapse, and blank-line limits while leaving words and punctuation untouched.

Privacy: your files never leave your device. All processing happens locally in your browser.

How to use

  1. 1.Paste the plain text to clean.
  2. 2.Choose line trimming, horizontal whitespace collapse, and the maximum blank-line run.
  3. 3.Format the text and verify the exact output and line counts.

About Text Formatter

Text Formatter cleans plain-text spacing with three explicit controls instead of guessing how prose should look. Paste up to 1,000,000 UTF-16 code units, choose whether to trim each line, collapse horizontal whitespace, and retain zero, one, or two consecutive blank lines, then inspect the exact result. All processing happens locally in the browser.

Trim each line removes recognized leading and trailing whitespace from every logical line. It does not remove whitespace inside a line. Collapse horizontal whitespace replaces each run of ordinary spaces, tabs, and non-breaking spaces inside a line with one ordinary space. When both options are enabled, collapsing happens first and trimming then removes any resulting edge space.

The blank-line control runs after the per-line transformations. A line is blank when its resulting string is empty. Zero removes every blank line, one preserves at most one consecutive blank line, and two preserves at most two. The tool never invents a blank line where none existed. Leading and trailing blank runs follow the same maximum as runs in the middle.

CRLF, standalone CR, and LF are recognized as boundaries, with CRLF treated as one. Output boundaries use LF. This normalizes mixed source endings while keeping the content of retained lines. Visual wrapping in the result textarea does not insert additional newline characters.

The formatter does not change capitalization, spelling, punctuation, quotation marks, Markdown syntax, HTML, indentation beyond selected edge trimming, or sentence structure. It does not add headings, bullets, paragraph indentation, typographic quotes, or language-specific spacing. The name formatter refers strictly to the disclosed whitespace rules.

Leaving trim disabled preserves all edge whitespace except where a line is removed by the chosen blank rule after other transformations. Leaving collapse disabled preserves tabs, repeated spaces, and non-breaking spaces inside retained lines. These options allow conservative cleanup instead of an irreversible all-or-nothing preset.

Empty input is rejected because there is no operation to review. Input at exactly 1,000,000 UTF-16 code units is accepted, while one additional unit produces an explicit error and no partial output. The bound protects transformation and textarea rendering from unexpectedly large pasted content.

The result reports input and output line counts. A lower output count reflects removed blank lines; trimming and horizontal collapse alone do not change line count. The original textarea remains unchanged, making it possible to compare or adjust options. Editing any input or option clears the old result immediately.

Use this tool for copied prose, notes, prompt text, simple lists, or drafts that contain inconsistent spaces and excessive vertical gaps. Do not use it on whitespace-sensitive source code, YAML, Python, Makefiles, fixed-width records, ASCII art, or signed text unless the selected transformations are known to be safe.

This is not a rich-text or document-layout editor. It cannot preserve font styles, tables, page breaks, Word formatting, or PDF geometry because it receives a browser string only. It also does not parse CSV quoting or Markdown code fences, so blank and whitespace changes apply uniformly across the input.

The implementation makes one bounded pass to transform lines and one pass to cap blank runs. No dependency, network request, dictionary, or remote model is used. The same accepted input and options always produce the same LF-normalized result and counts.

Review the output before replacing a source. Whitespace can carry meaning in technical formats even when it looks cosmetic. For deleting only blank lines use Remove Empty Lines; for changing newline representation use Line Break Converter; for joining all lines use Line Break Remover.

Methodology & sources

Validate nonempty text at or below 1,000,000 UTF-16 code units, split CRLF before standalone CR or LF, optionally collapse horizontal runs of tab, ordinary space, and NBSP to one space, optionally trim each transformed line, retain no more than the selected zero-to-two consecutive empty lines in one ordered pass, join output with LF, and report input and output line counts without semantic rewriting.

Frequently asked questions

Does the tool rewrite punctuation or capitalization?
No. It changes only the selected whitespace and blank-line behavior.
What horizontal whitespace is collapsed?
Runs of spaces, tabs, and non-breaking spaces become one ordinary space.
Are mixed line endings normalized?
Yes. CRLF, CR, and LF are recognized and generated output uses LF.
Is my text uploaded?
No. Formatting and result rendering happen locally.

Text Tools guides

View all