JSON Formatter
JSON Formatter for developers — instant, offline-style and privacy-safe.
Escape the five HTML-special characters — ampersand, less-than, greater-than, double quote and apostrophe — so text shows as text instead of becoming markup. Runs in your browser.
Your browser is preparing the tool. It runs 100% locally.
Paste text and the tool replaces the five characters that have special meaning in HTML — ampersand, less-than, greater-than, double quote and apostrophe — with their character references, so a browser shows them as literal text instead of treating them as tags or attributes. The apostrophe uses the numeric reference 39 (the universally safe form). Everything else, including accents and emoji, is left as-is. It runs entirely in your browser.
Type or paste text and you get a version that is safe to drop inside an HTML page. The ampersand becomes its amp entity, the less-than and greater-than signs become their lt and gt entities, the double quote becomes its quot entity, and the apostrophe becomes the numeric reference 39 — so a snippet of code or markup displays as written rather than being parsed.
These five characters are the ones that can break HTML or open a cross-site-scripting hole. Encoding them is the standard way to show user-supplied or code text on a page without the browser mistaking it for real markup.
The tool scans your text for the five special characters and swaps each for its character reference. The less-than sign is the most important — it is what opens a tag — so neutralising it (and the other four) stops the browser from interpreting your text as elements, attributes or entities.
It uses named references for four of them and a numeric reference for the apostrophe. The named apostrophe entity is not part of older HTML, so the numeric form (reference 39) is used instead, which every browser understands. Characters beyond these five — letters, accents, emoji — are left exactly as they are.
ampersand → amp entity
less-than → lt entity
greater-than → gt entity
double quote → quot entity
apostrophe → numeric reference 39Only these five are changed. Accents, emoji and every other character are left untouched, which is valid in a UTF-8 page.
The text is escaped in your browser with a small character replacement; nothing is uploaded, so you can safely encode private content.
Encoding is for safe display, not security by itself. It stops text from being parsed as markup, but it is not a substitute for proper, context-aware output encoding across a whole application.
| Escapes | ampersand, less-than, greater-than, double quote, apostrophe |
|---|---|
| Ampersand | named amp reference |
| Angle brackets and quote | named lt, gt, quot references |
| Apostrophe | numeric reference 39 |
| Other characters | left as-is (accents and emoji included) |
| Purpose | show text as text; help prevent XSS |
| Where it runs | In your browser — nothing uploaded |
It escapes exactly five characters. That is the right set for text placed in normal HTML content, but other contexts need more: a value inside an HTML attribute, a URL, JavaScript or CSS each have their own encoding rules, and this tool does not cover them.
It does not encode accents, symbols or emoji into entities. On a UTF-8 page that is correct — those characters display fine as themselves — so the output is intentionally minimal, not a full entity conversion of every non-ASCII character.
The ampersand is encoded first on purpose. If it were not, the entities created for the other characters could be re-encoded, turning an amp reference into a broken double-encoded string.
Encoding is not a complete XSS defence. It neutralises the five structural characters in HTML content, but safe applications also validate input and encode correctly for every output context. Treat this as one layer, not the whole shield.
Run text through twice and it double-encodes: the ampersands in the entities from the first pass get escaped again, so an amp reference becomes a longer, wrong string. Encode once.
Display HTML or markup as text in a tutorial or doc without it rendering.
Make user-supplied text safe to insert into HTML content.
Prepare a snippet that contains special characters for an HTML file.
Stop a stray angle bracket or ampersand from breaking a page.
Need to turn entities back into characters? Use the HTML decoder. Putting text in a URL? Use the URL encoder. Building a secure app? Pair this with input validation and context-aware encoding throughout.
Escapes exactly the five HTML-special characters — ampersand, the two angle brackets, double quote and apostrophe — using named references for four and the numeric reference 39 for the apostrophe (valid in all HTML); other characters, including accents and emoji, are left as-is, and it is honest that this is one XSS layer, not a complete defence.
JSON Formatter for developers — instant, offline-style and privacy-safe.
JSON Validator for developers — instant, offline-style and privacy-safe.
Base64 Encoder for developers — instant, offline-style and privacy-safe.
Fast, free Hash Generator that runs entirely client-side in your browser.
Fast, free UUID Generator that runs entirely client-side in your browser.
Fast, free CSS Minifier that runs entirely client-side in your browser.
It is free, private and runs entirely in your browser — no sign-up, no uploads, no limits.