HTML Entities Encode & Decode Online — Escape & Unescape Text

Turn raw characters into HTML or XML entities, and back. Useful before you put user content into markup or when you debug escaped payloads. The options cover quote escaping for strings you paste into attributes.

Loading…
Escaping and unescaping HTML entities
Putting raw strings into HTML attributes or JSX templates can break the markup or open the door to XSS. Escaping &, <, > and, if you choose, quotes neutralizes those injections without changing the visible text. FastMinify encodes with separate toggles for quotes and decodes numeric and named references.

What happens in encode and decode modes

Encode scans your text from left to right and replaces structural characters with predefined entities such as &amp;, &lt;, and optional &quot; and &#39; pairs. Decode expands decimal &#123;, hexadecimal &#x7B;, and common named entities back into literal Unicode characters. It iterates until nested sequences like &amp;lt; settle. Decode ignores your quote switches because entities already encode the quoting intent.

Quote escaping switches

Enable double-quote encoding when you embed values inside double-quoted HTML attributes or JSON-like snippets. Enable apostrophe encoding when you wrap strings in single-quoted attributes, which is common in legacy PHP templates. Always back up browser-side helpers with strict server sanitization before you store anything.

Examples

Attribute-ready snippet

Original

<div class="demo" data-label="Johnson & Sons" data-price="$100"> <p>Status: in stock &mdash; ships today</p> <blockquote>"Quality first" &mdash; founder</blockquote> <script>alert("xss-demo")</script> </div>

Escaped

&lt;div class=&quot;demo&quot; data-label=&quot;Johnson &amp; Sons&quot; data-price=&quot;$100&quot;&gt; &lt;p&gt;Status: in stock &amp;mdash; ships today&lt;/p&gt; &lt;blockquote&gt;&quot;Quality first&quot; &amp;mdash; founder&lt;/blockquote&gt; &lt;script&gt;alert(&quot;xss-demo&quot;)&lt;/script&gt; &lt;/div&gt;

Decode numeric entities

Original

&copy; 2026 &#8212; caf&eacute;

Escaped

© 2026 — café

Keep workflows cohesive

Large markup payloads belong in the HTML minifier. Inline scripts benefit from JavaScript compression, and structured feeds pair well with JSON formatting.

HTML entities FAQ

Prevent markup breakage while retaining readability

Does escaping replace server-side sanitization?

No. Never treat a client-side utility as authoritative. Always validate on the server, for example with a library such as DOMPurify.

Which entities are decoded?

Numeric decimal/hex forms plus frequently used named entities like nbsp, quot, amp, copy, mdash.

Why escape apostrophes?

A single-quoted attribute ends early if an apostrophe stays literal. Writing &#39; avoids that parsing surprise.

Will decode strip legitimate ampersands?

Well-formed entities expand, and stray ampersands remain untouched unless they are part of valid sequences.

Is processing private?

Yes. Everything stays inside your browser session.

Does encode mode escape every special HTML character?

Always for &, <, and >; quote switches add &quot; or &#39; when you paste into attributes. Other characters stay literal unless already written as entities.

Can I paste this output straight into React or JSX?

Treat the output as a helper for samples. Frameworks already escape text nodes, so follow the React, Vue, or Svelte guidance instead of relying on manual escapes alone.

How is this different from the URL encoder?

HTML entities make text safe inside markup, while percent-encoding prepares strings for URLs. Use URL encode for query strings, then entities for HTML context.

Encode or decode Base64, URLs, HTML entities and JWTs, and generate hashes and HMACs in your browser.