Skip to content

Prompt Cleaner

Find and remove the smart quotes, zero-width characters and hidden Unicode that a copy-paste puts into an AI prompt — and see exactly what was in there.

Your prompt

Cleaned

The cleaned prompt appears here.

Rules

nothing to change

Every rule is a plain text substitution applied in your browser. Nothing is uploaded, and no model is called — this prompt cleaner costs nothing to run and works offline.

About the Prompt Cleaner

This prompt cleaner finds the characters that get into a prompt when you copy it out of a document, a chat window, a PDF or a web page — curly quotes, non-breaking spaces, zero-width characters and worse — and takes them out. Every rule is a plain text substitution, applied in your browser. No model is called, so it costs nothing and works offline.

Two different problems share one tool here. The first is typography: Word, Google Docs and most chat clients rewrite " as “ ”, -- as an em dash and ... as a single ellipsis character. In prose that is correct. In a prompt containing JSON or code it is not — {“key”: “value”} is not JSON, and a model asked to reproduce it exactly will faithfully copy the wrong characters.

The second is invisible characters. Zero-width spaces, bidirectional overrides and Unicode tag characters render as nothing at all, so a prompt can carry text you cannot see. The tag block (U+E0000–U+E007F) is the one that matters: it mirrors ASCII, so an arbitrary instruction can be encoded in it and pasted into a prompt completely invisibly. When this tool finds any, it decodes and shows you the hidden text rather than silently deleting it.

The rules that only remove noise are on by default. The ones that could destroy meaning — converting em dashes, expanding tabs, deleting replacement characters — are off, and each one says why.

  • Every character found is listed by code point, name, count and the line it first appeared on
  • Hidden text encoded in Unicode tag characters is decoded and shown, not just removed
  • Smart quotes, primes, ellipses and dashes mapped to their ASCII equivalents
  • Zero-width, bidi override, soft hyphen and non-breaking space removal
  • Whitespace normalisation: CRLF to LF, trailing spaces, runs of blank lines
  • Fifteen rules, each independently switchable, with the before and after byte count

How to use it

  1. Paste your prompt into the left pane.
  2. Read the table underneath. It lists every character that was found, what it is, and how many times it appears.
  3. Leave the default rules on unless you have a reason to change them. Em dashes and tabs are off by default, because both are legitimate in ordinary text.
  4. Copy the cleaned prompt from the right pane.
  5. If a red panel appears, stop and read it — the prompt contains invisible text that someone encoded deliberately.

Real-world use cases

Prompt & AI engineers

Clean a system prompt before it goes into a prompt library or version control, so the file that gets reviewed and diffed is the same ASCII-safe text that gets sent — not a copy still carrying curly quotes from the doc it was drafted in.

Backend & API developers

Sanitise prompt templates pulled from a CMS, a support ticket or a database field before they are interpolated into an API call, catching the smart quotes that silently break embedded JSON.

QA & support engineers

Paste a prompt from a bug report or a Slack thread to see exactly what is in it — including characters that render as nothing — instead of trying to spot an invisible character by eye.

Security & AppSec engineers

Screen an externally-sourced or user-submitted prompt for Unicode tag characters before it reaches a model, since that block is a working, invisible prompt-injection channel and this tool decodes exactly what it finds.

Technical writers

Verify that a prompt example destined for documentation is genuinely copy-pasteable — that the JSON in it is real JSON and not curly-quoted prose that will fail the moment a reader tries it.

Examples

JSON broken by a word processor

Input
{“name”: “value”}
Output
{"name": "value"}

The single most common way a prompt containing JSON stops working. The curly quotes are U+201C and U+201D, which are not string delimiters in any language.

An invisible character between two words

Input
hello​world
Output
helloworld

There is a U+200B ZERO WIDTH SPACE between “hello” and “world” above. It is a real character that costs a token and splits the word in two for the tokenizer.

A non-breaking space in a command

Input
npm install
Output
npm install

The space in the input is U+00A0. It looks identical, and a shell will not accept it as an argument separator. Splitting that string on a normal space gives one token, not two.

Whitespace nobody can see

Input
Summarise this.   \n\n\n\n\nThen list three risks.   
Output
Summarise this.\n\nThen list three risks.

Trailing spaces and runs of blank lines are invisible and are billed on every request.

Common errors

MessageCauseFix
Expected property name or '}' in JSON at position 1The JSON in your prompt has curly quotes instead of straight ones, because it went through a document editor.Run it through here with the smart quotes rule on. This is the failure this tool exists for.
The model ignores part of my promptZero-width or bidi characters can split a word into separate tokens, so a keyword the model was matching on is no longer one word.Check the character table for anything under Zero-width characters, and clean it.
A prompt from someone else behaves strangelyIt may contain instructions encoded in Unicode tag characters, which render as nothing at all.Paste it here. If any are present, the hidden text is decoded and shown in a red panel before you use the prompt.
command not found, or bad substitution in a shellA non-breaking space (U+00A0) or a narrow no-break space (U+202F) instead of an ordinary space.Clean with the non-breaking spaces rule on. The output is visually identical and actually works.
A replacement character (�) in the textThe text was already decoded with the wrong character encoding. The original character is gone.Do not delete it — that hides the real bug. Re-copy the source as UTF-8. The rule is off by default for this reason.
Token count is higher than the text looksTrailing whitespace, runs of blank lines, or invisible characters that each become their own token.Clean it and compare the byte counts shown above each pane.

Frequently asked questions

Is my prompt sent anywhere?

No. Every rule is a regular expression replacement that runs in your browser. There is no server call and no model call, which is also why this tool has no rate limit — you can paste a confidential prompt into it and confirm with your network disconnected that nothing leaves the page.

Why are em dashes off by default?

Because an em dash in prose is correct typography, not a defect. It only matters when the text is a command line or a code sample where `--flag` was intended. Turning the rule on converts an em dash to two hyphens and an en dash to one, but you should be deciding that, not the tool.

What are Unicode tag characters and why do they get their own panel?

U+E0000 to U+E007F is a block that mirrors ASCII and renders as nothing. Any string can be encoded in it and pasted into a prompt invisibly, which makes it a working prompt-injection channel — the text is invisible to a human reviewing the prompt but is ordinary input to a tokenizer. This tool decodes what it finds and shows it to you, because if someone hid an instruction in a prompt they sent you, the instruction is the thing you want to read.

Does removing zero-width characters change what the model does?

It can, and that is the point. A zero-width space inside a word splits it into two tokens, so a model matching on that word no longer sees it. They also cost tokens: every invisible character is billed exactly like a visible one.

Will this break my emoji or non-English text?

No. The rules match specific code points — quotation marks, spaces, zero-width and formatting characters — not everything outside ASCII. Emoji, CJK, Arabic, accented Latin and every other real script pass through untouched. You can verify it: paste some and the character table will report nothing.

Why is the tab rule off by default?

A tab can be load-bearing. In a Makefile it is syntax, and in TSV data it is the delimiter. Expanding tabs to spaces there produces a file that no longer works, so the rule is offered rather than assumed.

Is this the same as trimming whitespace?

No. Trimming handles the spaces you can find with a search. The characters this tool is actually for — U+00A0, U+200B, U+FEFF, U+202E — are the ones that look like nothing or look exactly like something else, which is why they survive every manual attempt to clean a prompt by eye.

Should I run every prompt through this before saving it to a prompt library?

For anything pasted in from outside your editor — a doc, a chat export, a PDF, a ticket — yes. Prompts typed directly into a plain-text editor rarely pick up smart quotes or invisible characters in the first place; the risk is almost entirely in copy-paste, so that is the point to make cleaning a habit.

Last updated