Text Cleaner
Clean messy copy-pasted text: strip extra whitespace, empty lines, HTML tags, invisible characters and duplicate lines in one click.
Steps run in this order: HTML → entities → characters → line breaks → spaces → trim → empty lines → duplicates → sort → find & replace → numbering.
What is the Text Cleaner?
The Text Cleaner fixes messy copy-pasted text in one place. Instead of running one action at a time, you switch on the cleanup steps you need and see the result update live next to the original, together with a summary of exactly what changed — how many invisible characters, duplicate lines, emoji or URLs were removed and how many replacements were made.
Character-level steps strip HTML tags while keeping paragraph and line structure (scripts and styles are discarded, and the markup is parsed in an inert document so nothing in it can run or load), decode HTML entities such as & and , remove zero-width spaces, byte-order marks, soft hyphens and bidirectional control characters, turn non-breaking and other exotic spaces into normal spaces, convert curly quotes, dashes and ellipses to plain ASCII, and remove emoji, URLs or e-mail addresses. Line-level steps trim lines, collapse repeated spaces, remove or collapse empty lines, join broken lines from PDFs while keeping paragraphs, remove duplicate lines while keeping the original order, and sort lines alphabetically, naturally (item2 before item10), by length or in reverse.
A find & replace step supports plain text or regular expressions with capture groups ($1, $<name>), case-sensitive matching and \n for new lines, and invalid patterns are reported instead of breaking the page. Presets set up common jobs — cleaning PDF or Word pastes, tidying a list, converting HTML to plain text — and everything runs locally in your browser.
Frequently asked questions
- Why does text copied from a PDF have broken lines?
- PDFs store text as positioned lines, so copying inserts a hard line break at the end of every visual line. Choose “Join lines, keep paragraphs” (or the PDF / Word preset) to merge the lines inside each paragraph while keeping the blank lines that separate paragraphs.
- What are invisible characters?
- Characters that take no visible space but still exist in the text: zero-width spaces (U+200B), byte-order marks (U+FEFF), soft hyphens, word joiners and left-to-right/right-to-left marks. They come from web pages, Word and chat apps and break searches, comparisons, CSV imports and code. Zero-width joiners inside emoji such as 👨👩👧 are kept so the emoji stay intact.
- Is stripping HTML safe?
- Yes. The HTML is parsed into an inert document with the browser's DOMParser: scripts never execute and images or styles are never downloaded. Script, style and template contents are discarded, block elements such as paragraphs, list items and table rows become line breaks, and entities are decoded.
- How does duplicate line removal work?
- It keeps the first occurrence of every line and removes later repeats, preserving the original order (sort afterwards if you want). The “ignore case & spaces” mode treats “Apple”, “apple” and “ apple ” as the same line. Blank lines are never treated as duplicates.
- Can I use regular expressions?
- Yes. Enable “Regular expression” to use JavaScript regex syntax with Unicode support; ^ and $ match at every line, and the replacement can reference groups with $1 or $<name> and the whole match with $&. Leave “Replace with” empty to delete matches. Write \n or \t in either field for a new line or tab.
- Is my text uploaded?
- No. All processing happens in your browser and nothing is sent to a server or stored.
Related tools
- Case ConverterConvert text to UPPERCASE, lowercase, Title Case, camelCase, PascalCase, snake_case, kebab-case and more. Instant, free and fully offline.
- Word & Char CounterCount words, characters, sentences and paragraphs, estimate reading and speaking time, check platform limits and analyze keyword density — all in your browser.
- Lorem IpsumGenerate lorem ipsum placeholder text by paragraphs, sentences or words for mockups, wireframes and UI prototypes. Copy as plain text or HTML.
- Text DiffCompare two texts side by side or as a unified diff and highlight differences by line, word or character. Handles thousands of lines, privately and offline.
- Slug GeneratorTurn titles and headlines into clean, SEO-friendly URL slugs with transliteration, custom separators and bulk mode.
- HTML EntitiesEncode special characters to HTML entities (named, decimal or hex) and decode entities back to text. Escape HTML safely, entirely offline.