Text Formatter for Messy Pasted Text

Paste text from a PDF, an email thread or a chat export. Nine cleanup steps run top to bottom, each with its own switch. Every step reports how much changed. Your text stays in this browser tab.

Format text

Steps, in run order

  1. off

    Zero-width spaces, soft hyphens, byte order marks. No-break spaces turn into normal ones.

  2. off

    Curly quotes to straight, long dashes to hyphens, the ellipsis character to three dots.

  3. off
  4. off

    Runs of spaces or tabs inside a line become one space.

  5. off
  6. off

    Runs only when half the lines or more start with a marker.

  7. off
  8. off
  9. off
Output updates as you type
0lines in
0lines out
0characters in
0characters out
Read-only

Why the nine steps run in this order

The order is fixed. Each step reads the result of the one above, so moving a step would change the output. Four of the choices matter more than the rest.

Invisible characters go first
The space collapser in step 4 matches plain spaces and tabs only. A no-break space copied from Word slips past unless step 1 has already turned the character into a regular space.
Blank lines settle before numbering
Empty gaps get removed or squeezed first. A stray blank line never claims number 4 and pushes your last item to 6.
Old numbers come off before new ones go on
Skip step 6 on a pasted list and renumbering gives you 1. 1. Book the venue. Step 6 clears the old marker, step 8 writes the new one.
Wrapping runs last
Line width only means something once the number prefix exists. Wrapping at the end lets each continuation line indent under the text, the way a printed numbered list looks.

One messy paste, before and after

The Load sample button fills the box with five sprint notes copied out of a chat thread after three people edited the list. Orange tags mark characters you won't see on screen.

ZWSP zero-width space   NBSP no-break space   TAB tab   3 sp run of spaces

Pasted
2 sp1. Mehreen Shah moved the JSONZWSP beautifier to the new editor.2 sp
2.3 spTomás Ruiz found a bug: “smart quotes” break the CSV parser.TAB


3) Ifeoma Bello will retest the sitemap on staging.toolexe.com before Friday.NBSPNBSP
• Kenji Watanabe asked for a dark theme on the regex tester – no date yet.
5. Dana Whitfield is still chasing the4 spfavicon cache on cdn.toolexe.com.
After the Renumber a list preset
1. Mehreen Shah moved the JSON beautifier to the new editor.
2. Tomás Ruiz found a bug: “smart quotes” break the CSV parser.
3. Ifeoma Bello will retest the sitemap on staging.toolexe.com before Friday.
4. Kenji Watanabe asked for a dark theme on the regex tester – no date yet.
5. Dana Whitfield is still chasing the favicon cache on cdn.toolexe.com.

The curly quotes survived. This preset leaves step 2 off, since curly quotes read fine in a chat or a doc. Tick Straighten quotes & dashes before the text goes into a CSV file, a terminal or a code editor, where “ is a different character from " and breaks parsing.

What each step changes, and what stays untouched

The right-hand column matters as much as the middle one. Most formatting accidents come from a step touching text you expected to stay put.

StepChangesLeaves alone
1. Invisible charactersRemoves zero-width spaces (U+200B), word joiners (U+2060), byte order marks (U+FEFF) and soft hyphens (U+00AD). Turns no-break spaces (U+00A0, U+202F) and typographic spaces (U+2000 to U+200A) into plain spaces.Zero-width joiners and non-joiners. Emoji families such as a parent with two kids are built from joiners, and Persian or Hindi spelling depends on them.
2. Quotes & dashesCurly single and double quotes become ' and ". En dashes, em dashes and the minus sign become -. The single ellipsis character becomes ...Prime marks in measurements like 5′11″, French guillemets, apostrophes already typed straight.
3. Trim line endsSpaces and tabs at both ends of every line.The left edge, once you tick Keep leading indentation.
4. Collapse spacesAny run of two or more spaces, plus every tab inside a line, shrinks to one space.Single spaces. Leading indentation, when kept.
5. Blank linesLines holding nothing or only whitespace, plus empty lines at the top or bottom.Any line with a visible character, even a lone period.
6. Strip numbers & bullets1. 2) (3) [4] #5 • - * + at the start of a line, or a number followed by a tab, as editors paste line numbers.Clock times like 10:30, decimals like 1.5. Every line, when under half the lines carry a marker.
7. Change caseLetters in any script with upper and lower forms: Latin, Greek, Cyrillic, Armenian.Digits, punctuation, scripts without case such as Arabic, Hebrew, Chinese or Hindi.
8. Add numbersPrefixes each line with a number, right-aligned so the text column stays straight past 9 or 99.Numbers already in the text. Pair with step 6 to replace them.
9. Wrap linesBreaks any line longer than your width at the last space before the limit. Continuation lines indent under the text, past the number or bullet.Single words longer than the width, such as a long URL. They stay whole on a line of their own.

Five invisible characters worth knowing by name

None of these show up in a text box. All five survive copy and paste. When two strings look identical but a search, a spreadsheet formula or a database lookup treats them as different, one of these is the usual suspect. Step 1 handles all five.

CharacterCodeWhere you pick one upWhat goes wrong
No-break spaceU+00A0Word, Google Docs, web pages written with  Ctrl+F for two words misses the match. Excel refuses to treat 1 250 as a number.
Zero-width spaceU+200BCMS editors, chat apps, some PDF exportsTwo JSON keys or usernames look identical on screen yet fail an equality check.
Byte order markU+FEFFFiles saved as UTF-8 with BOM, a default in older Notepad and Excel CSV exportsThe first CSV header reads as \uFEFFid, so a lookup on id comes back empty.
Soft hyphenU+00ADPDFs, e-books, justified layoutsA word split by an unseen hyphen fails spell check and site search.
Narrow no-break spaceU+202FTimes formatted by recent ICU versions, used in Chrome and Node.js 20, as in 10:30 AMDate parsers built for a normal space reject the string.

Where this formatter gets things wrong

Every step follows fixed rules. None of them reads meaning. A few outputs need a human pass before you publish.

Size. All nine steps on 5 MB of text, roughly 800,000 words, take about half a second on a mid-range laptop. Past 10 MB the paste itself makes the text box sluggish. A command-line tool such as sed or a script handles log files past 10 MB better.

Text formatter questions

Short answers on privacy, numbering and wrap widths.

Does the formatter send my text anywhere?

No. Every step runs as JavaScript inside this tab. Nothing gets uploaded, logged or saved. Closing the tab discards the text.

Why does Strip old numbers say skipped?

Fewer than half of the non-empty lines start with a number or bullet. The step stops on purpose, so a paragraph opening with a year such as 2024: keeps its first word.

How do I renumber a list after deleting items?

Press Renumber a list. Step 6 removes the old markers, whatever mix of 1. 2) and bullets they are, then step 8 numbers the lines again from 1 or from any start number you type.

Why do my numbers have a space in front?

Numbers get right-aligned, so line 9 reads " 9." next to "10." and the text column stays straight. Pick the 01 style for zero padding with no leading space.

Will Collapse repeated spaces break my code?

Yes, wherever you aligned values with extra spaces. The Code or config preset keeps collapse off, keeps indentation, straightens curly quotes and drops trailing whitespace.

What width should I wrap at?

72 suits plain-text email and git commit bodies. 80 matches terminal windows and most code style guides. Go to 100 or 120 only if your linter allows long lines.