Copy-Paste Sanitizer
Clean and sanitize text copied from websites, PDFs, and documents - remove formatting, special characters, and extra whitespace
Quick Presets
Sanitization Options
All text processing is done locally in your browser.
In-depth guide
Copy-paste sanitizer: the cleaning pipeline, presets and pitfalls
The exact order of the nine options, which quotes and dashes are replaced, what the three presets set, and the traps: non-breaking spaces survive unless non-ASCII removal is ticked, and that option deletes all accented, Chinese, Tamil and emoji text.
Key figures at a glance
- Options
- Nine checkboxes, three presets
- Presets only tick boxes; press Sanitize Text to run.
- Smart quotes
- Twelve characters converted
- U+2018 U+2019 U+201A U+201B U+201C U+201D U+201E U+201F U+2039 U+203A U+00AB U+00BB become ASCII quotes, including German-style low quotes.
- Remove non-ASCII characters
- Deletes everything outside printable ASCII
- Accents, Chinese, Tamil, emoji, euro and pound signs are removed; non-breaking and other Unicode spaces become normal spaces first.
- Formatting
- No formatting option
- The input box is plain text, so pasting already drops bold, italic and links; the old Remove all formatting checkbox never did anything and was removed.
How it runs
Paste text, choose a preset or tick options, and press Sanitize Text. Nothing is live and nothing is uploaded. The button replaces the output box with the result and shows original length, cleaned length, removed and reduction percentage (UTF-16 units, one decimal place). If nothing changed it says so. Copy and Download use the output.
Steps run in this fixed order, each only if its option is ticked:
- Hidden characters: U+200B, U+200C, U+200D, U+2060, U+FEFF; control characters U+0000 to U+0008, U+000B, U+000C, U+000E to U+001F, U+007F to U+009F; U+00AD, U+034F, U+061C, U+115F, U+1160, U+17B4, U+17B5, U+180E, U+3164; direction marks U+200E, U+200F, U+202A to U+202E and the isolates U+2066 to U+2069; U+2028 and U+2029 become line feeds. Almost the same list as the hidden character cleaner, except that every joiner is removed (no emoji or Persian exception) and U+00A0 is left alone.
- Quotes: U+2018, U+2019, U+201A and U+201B become
'; U+201C, U+201D, U+201E and U+201F become"; U+2039 and U+203A become'; U+00AB and U+00BB become". - Dashes: en dash U+2013 and em dash U+2014 become a hyphen
-; the ellipsis U+2026 becomes.... - URLs: removes anything starting
http://,https://orwww.up to the next whitespace. - E-mail addresses: removes strings of the form
[email protected]. - Remove non-ASCII characters: first turns U+00A0 non-breaking space, U+1680, U+2000 to U+200A, U+202F, U+205F and U+3000 into a normal space, then deletes every character that is not printable ASCII, a line break or a tab.
- Line breaks: CRLF and lone CR become LF.
- Extra whitespace: runs of spaces and tabs become one space, three or more line feeds become two, and spaces and tabs at the start and end of every line are trimmed.
- Lowercase:
toLowerCase()on the result.
Computed examples
| Input | Options | Result |
|---|---|---|
“Don’t panic,” she said — it’s «fine»… |
Basic | "Don't panic," she said - it's "fine"... |
2020–2024, word—word |
Basic | 2020-2024, word-word |
„Hallo“ ‚x‘ |
Basic | "Hallo" 'x' |
see https://example.com/a, then www.test.org/x. or mail [email protected] now |
Aggressive | see then or mail now (the link's trailing , and . are removed with it) |
café 新加坡 தமிழ் €5 🙂 |
Aggressive | caf 5 |
10 U+00A0 km |
Basic | unchanged: the non-breaking space survives |
10 U+00A0 km |
Aggressive | 10 km: the non-breaking space becomes a normal space, so words stay apart |
a + 3 spaces + b + tab + c, then 4 line feeds, then d |
Basic | a b c, one blank line, d |
Presets
| Preset | Ticks |
|---|---|
| Basic Clean | hidden characters, quotes, dashes, extra whitespace, line breaks |
| Aggressive Clean | Basic plus non-ASCII removal, URLs and e-mails |
| Code-Friendly | hidden characters and quotes only; keeps indentation, dashes and line endings |
Lowercase is never part of a preset. Clicking a preset only sets the boxes, so press Sanitize Text afterwards.
What it does not catch
- Non-breaking space U+00A0 and other special spaces (U+2009 thin space, U+202F narrow no-break space) survive unless Remove non-ASCII characters is ticked; that option first turns U+00A0, U+1680, U+2000 to U+200A, U+202F, U+205F and U+3000 into normal spaces, so words stay apart. Word processors and web pages use these spaces, so with the option off a pasted sentence may still refuse to wrap or search. The extra-whitespace option does not touch them either.
- Primes and other look-alikes: prime marks
′ ″, the minus sign U+2212, hyphen U+2010 and non-breaking hyphen U+2011 are not replaced. Low quotes such as German„Hallo“are converted:"Hallo". - Joiners: removing U+200D splits emoji such as
👨👩👧into three emoji, and removing U+200C damages Persian text. Untick "hidden characters" for such text. - Unicode normalisation (NFC/NFD) is not performed, and the BOM is removed everywhere, not only at the start.
- URL removal also removes trailing punctuation that was attached to the link.
Tip: For source code use the Code-Friendly preset. Tick extra whitespace and indentation is lost: every line is trimmed.
Common mistakes
- Choosing Aggressive Clean for non-English text, which deletes accented letters, Chinese and Tamil outright.
- Looking for a remove-formatting option. There is none: the input box is plain text, so pasted bold, italic and links are already gone.
- Expecting the preset button to run the clean-up.
- Believing the result is free of invisible characters. Check with the hidden character cleaner or a hex view such as text to hex.
Related tools
Hidden character cleaner shows exactly which hidden characters are present. Remove line breaks and Text minifier handle line breaks and spacing. Case converter offers more case styles than the single lowercase option. Text diff shows what changed.
Frequently Asked Questions
What is a copy-paste sanitizer?
A copy-paste sanitizer is a tool that cleans text copied from websites, PDFs, Word documents, and other sources by removing unwanted formatting, hidden characters, smart quotes, extra whitespace, and special characters. It gives you clean, plain text that's safe to paste anywhere without issues.
Why do I need to sanitize copied text?
You need to sanitize copied text because sources like websites, PDFs, and Word documents include hidden formatting, smart quotes, special dashes, invisible Unicode characters, and excessive whitespace that can cause problems when pasted into forms, code editors, databases, or other applications.
Is my text sent to any server?
No, absolutely not. All text sanitization happens entirely in your web browser using JavaScript. Your data never leaves your device, making this tool completely safe for sensitive documents, proprietary code, customer data, and confidential content.
What's the difference between the presets?
Basic Clean removes formatting and normalizes text (best for general use). Aggressive Clean also removes URLs, email addresses and every non-ASCII character, so accents, Chinese, Tamil and emoji are deleted (best for English-only legacy systems and databases). Code-Friendly preserves code structure (best for programming).
Will this damage my text content?
No, the tool only removes formatting and special characters based on your selected options. The actual words and content remain unchanged. However, if your text intentionally uses special characters or formatting, those will be removed, so always review the output before using it.
Can I clean code snippets?
Yes, use the Code-Friendly preset which removes problematic characters like smart quotes and hidden Unicode characters while preserving indentation, line breaks, and code structure. Perfect for cleaning code copied from Stack Overflow, documentation, or tutorials.
What are smart quotes and why remove them?
Smart quotes (curly quotes like "" and '') are typographically correct but cause problems in plain text, code, and many applications. Straight quotes ("" and '') work universally. This tool converts smart quotes to straight quotes for maximum compatibility.
How do I handle text from PDFs?
PDF text often has excessive line breaks and spacing. Use Basic Clean preset which normalizes whitespace and removes hidden characters. The text will be reformatted into properly structured paragraphs and sentences.
Can this remove URLs and email addresses?
Yes, enable the "Remove URLs" and "Remove email addresses" options, or use the Aggressive Clean preset which includes these options. Useful when cleaning text for databases or when you want to remove contact information.
What happens to line breaks?
Line breaks are normalized to LF (Unix-style) when "Normalize line breaks" is enabled. The tool also removes excessive blank lines (more than 2) while preserving paragraph structure. This ensures consistent formatting across all platforms.
Is there a character limit?
No, there's no hard character limit. However, very large texts (hundreds of thousands of characters) may take a moment to process. The tool handles typical copy-paste scenarios (up to tens of thousands of characters) instantly.
Can I use this tool offline?
Yes, after the initial page load, the tool works completely offline. All processing happens in your browser without any internet connection required. Perfect for working with sensitive data in secure environments.
Sources
- Unicode — Code charts (General Punctuation, U+2000 block) — Names for the quotation marks, dashes and ellipsis the tool replaces.
- Unicode FAQ — UTF-8, UTF-16, UTF-32 and BOM — U+FEFF as byte order mark and zero width no-break space.
- MDN — Regular expression character class escape
This guide explains published rules in plain language. It is not financial, legal or official advice — rules change, so confirm with the agency linked above before you commit.