HTML Entity Encoder & Decoder
Escape text for safe HTML output or decode entities from CMS exports, emails, and legacy templates.
Optional numeric encoding helps when you need every non-ASCII character represented explicitly.
How to use
- Encode: Paste text with special characters; output shows safe HTML entity form for use in attributes or HTML source.
- Numeric entities: Check the option to encode every character as numeric codes (e.g.
Afor A). - Decode: Paste strings like
<span>to get plain<span>text. - Use Copy or Share URL to reuse results elsewhere.
1Entities exist to keep HTML unambiguous
Characters like <, >, and & have special meaning in HTML; entities let you display those symbols as content instead of letting the browser treat them as markup.
Named entities (such as & for an ampersand) and numeric references both map to Unicode code points, which is why the same decoder can handle international text.
- Encoding user-supplied text before insertion into HTML reduces the risk of accidental markup injection in templates and rich text editors.
- When you embed JSON inside HTML attributes, encoding quotes correctly matters as much as encoding angle brackets.
2When designers and developers use this tool
Content editors sometimes paste text from documents that already contains smart quotes or em dashes; decoding helps you see the exact characters your CMS will store.
Email and RSS feeds still mix escaped and unescaped fragments; converting both directions helps you normalize snippets before merging them into a page.
3A quick mental model
Think of encoding as preparing text for a specific transport format, and decoding as returning that text to plain Unicode for editing or analysis.
If a page shows mojibake (odd symbols), the issue is often charset mismatch rather than entities alone—but inspecting entity sequences can still narrow down the layer where corruption happened.
4Encoding in templates and CMS output
Server-side templates should encode dynamic text before HTML assembly. Client-side frameworks often handle this automatically, but raw `dangerouslySetInnerHTML` and markdown renderers need explicit care.
Double-encoding happens when already-escaped text is escaped again, producing `&lt;` in the browser. Decode once at the layer where you need plain text for editing.
5International characters
Numeric entities (`&#...;` or `&#x...;`) represent Unicode code points and work even when the page charset is misconfigured—though fixing charset is the real solution.
6Quick checklist for HTML encoding
Encode user-generated text at the boundary where it enters HTML, not only in the browser. Decode only when you need to edit or compare plain text.
- Encode quotes inside attribute values.
- Verify charset is UTF-8 end to end for international copy.
Examples
Encode for HTML output
Angle brackets become entities so they render as text.
Input: <script>alert(1)</script>
Output: <script>alert(1)</script>Decode from CMS export
Turn entity soup back into editable plain text.
Input: Tom & Jerry © 2026
Output: Tom & Jerry © 2026