Text cleanup guide
Clean the damage, not the document
A useful cleaner removes the artifact that arrived during copying or export while leaving intentional structure alone. The difficult part is identifying which marks are damage. A newline may be a broken PDF wrap, a real paragraph, a list boundary, a line of poetry, or part of a table. An invisible character may be accidental residue, or it may be required for Arabic, an Indic script, bidirectional text, or an emoji sequence.
This guide gives you a repeatable way to choose a cleanup method, inspect the result, and know when automatic cleaning is the wrong tool.
Copied from a PDF
Start with paragraph repair. Preserve blank lines, likely headings, lists, and table-like rows.
Copied from a chat tool
Remove Markdown only. Keep the words unchanged, then decide separately about citations or long dashes.
Copied from HTML
Discard scripts and styles, decode entities, and turn block elements into readable paragraph breaks.
Looks correct but behaves oddly
Inspect invisible Unicode before removing anything. Search, sorting, and comparison failures often begin here.
Begin with the source, not the desired appearance
First ask where the text came from. PDF text is commonly stored as positioned lines, so copying can place a newline at every visual wrap. A Markdown editor may add heading marks, emphasis, code fences, and link syntax. HTML source carries tags and encoded characters. A word processor can leave non-breaking spaces, tabs, or direction controls.
The source tells you which transformation is plausible. It also tells you what to protect. A report may contain page numbers and repeated headers. A research paper may contain citations that should remain in the authoritative copy. A message draft may need paragraph spacing but no other formatting. Starting with the source prevents a broad cleanup preset from flattening information you still need.
| Symptom | Likely cause | Start here | Check afterward |
|---|---|---|---|
| Every visual line ends early | Hard-wrapped PDF or narrow column | PDF paragraph repair | Headings, lists, columns, citations |
| Asterisks, hashes, fences, and link marks appear | Markdown or assistant formatting | Formatting cleanup | List numbering and URLs |
| Tags and entities appear as text | HTML copied from source or a CMS | HTML extraction | Links, generated content, malformed markup |
| Search says two visible strings differ | Zero-width or special spacing characters | Unicode inspection | Language shaping, direction, emoji |
| Words contain irregular gaps | Tabs, rich-text spacing, justification | Space cleanup | Indentation and table columns |
Repair PDF paragraphs conservatively
Paragraph repair should join lines inside a block, not delete every newline in the document. Blank lines often separate real paragraphs. Short lines may be headings. Lines beginning with bullets or numbering may be list items. Rows with repeated spacing may be tables, but automatic repair cannot reliably preserve their alignment. A conservative repair keeps known boundaries and joins ordinary prose with spaces.
Hyphenated line endings need a separate decision. Joining para- followed by graph is often useful when the next line begins with a lowercase letter, but the same rule can also join a real compound word. TextClean applies a narrow pattern, leaves the original beside the result, and expects the removed hyphens to be reviewed.
Do not flatten first and inspect later. Once list and paragraph boundaries are gone, rebuilding them is slower than reviewing a conservative result.
Keep formatting cleanup separate from rewriting
Markdown cleanup can remove heading markers, emphasis marks, block quote prefixes, list symbols, code fences, and link syntax while preserving the words inside them. That is a formatting operation. Changing the vocabulary, sentence order, tone, or argument is rewriting, and it should not be hidden inside a cleanup button.
The distinction is particularly useful for text copied from an assistant. You may want clean paragraphs for an email or document, but you still need to decide whether the wording is accurate and sounds like you. Removing formatting does not establish authorship, defeat a detector, or prove that a text is human-written.
Inspect invisible characters before deleting them
Zero-width spaces, joiners, direction marks, variation selectors, tag characters, and non-breaking spaces have different jobs. Some arrive accidentally from a website or document exporter. Others control writing direction, letter joining, or emoji presentation. A useful inspector names the character, code point, count, and position before offering removal.
If the text includes Arabic, Persian, an Indic script, mixed right-to-left and left-to-right content, or joined emoji, keep a copy and remove one category at a time. Visual similarity is not proof that the underlying strings are equivalent.
Use a three-pass check
- Structure: compare paragraph count, headings, lists, quotations, tables, and blank lines.
- Meaning: search for names, numbers, units, citations, URLs, and terms that must remain exact.
- Destination: preview the result where it will be used. Email, messaging, a blog editor, and a document handle spacing differently.
TextClean keeps the input and result in separate panes and reports the groups of changes that ran. Use Undo when a group changed more than intended. For a file, download to a new filename and keep the source unchanged.
Cases that still need a person
Automatic cleanup is a starting point for multi-column PDFs, tables that depend on alignment, code, poetry, transcripts with speaker timing, legal citations, bibliographies, and multilingual text with shaping controls. Scanned PDFs need OCR before their words can be cleaned. A tool can expose the change, but it cannot decide whether every visual boundary carries meaning.
How this guide is maintained
The examples reflect the behavior of TextClean's deterministic browser engine. Each supported transformation has recorded inputs and expected outputs. Tests cover ordinary cases and failure cases such as malformed markup, invalid patterns, repeated PDF page edges, and Unicode controls. The guide is revised when the underlying behavior changes or a new failure pattern is reproduced.
For the full set of controls, return to the browser cleaner. To preserve headings, lists, tables, and paragraphs from a file, use the document cleaner.
Published 23 October 2026. Reviewed 2 November 2026.