Free HTML Entity Encoder & Decoder
Convert raw text into safe HTML entities, or decode entities like & and → back into their literal characters. It helps web developers safely inspect reserved markup characters in templates, content, and imported text.
When you need HTML entity encoding
Any time raw, user-supplied, or otherwise untrusted text is going to be embedded directly into an HTML document, the characters &, <, >, ", and ' need to be converted to their entity equivalents first — otherwise a browser can interpret them as the start of a tag, an attribute boundary, or a broken attribute value rather than as literal text. This is the same escaping most templating engines and frameworks do automatically, made available here as a standalone tool for cases like preparing a static HTML snippet by hand or double-checking what a library is producing.
How to use this tool
Choose Encode to convert raw text into entity-safe HTML, or Decode to convert entities back into readable text — useful when inspecting HTML source or working with text copied out of a web page. The "encode non-ASCII" option additionally converts accented letters, symbols, and emoji into numeric character references for maximum compatibility with older systems.
Common use cases
- Safely embedding user-submitted text into a static HTML page or email template
- Decoding entity-encoded text copied from a webpage's source or an RSS/Atom feed
- Preparing example HTML/code snippets for documentation where angle brackets need to display literally
- Converting special characters for compatibility with legacy systems that don't handle raw UTF-8 well
Everything runs locally in your browser — nothing you type or paste here is ever sent to a server.
How to use HTML Entity Encoder/Decoder for related tasks
Paste text, encode HTML entities before embedding literal markup, or decode entities when reviewing content that displays unexpectedly.
Related tools: Encode / Decode, String Replacer / List Compare.
Frequently asked questions
What are HTML entities and why do I need to encode them?
HTML entities are text sequences like &, <, and > that represent characters with special meaning in HTML (&, <, >, quotes). If you embed raw text containing these characters directly into HTML markup, the browser can misinterpret them as the start of a tag or attribute — encoding them as entities makes the text display literally and safely.
What's the difference between the two encode modes?
"Basic" only encodes the five characters that are actually unsafe in HTML (&, <, >, ", ') and leaves everything else, including accented letters and emoji, untouched. "All non-ASCII" additionally converts every character beyond the basic ASCII range into a numeric entity, which is useful when you need output that's safe in older documents or systems with limited character-encoding support.
How does decoding work without a security risk?
Decoding uses the browser's own HTML parser through a hidden <textarea> element, which is a well-established safe technique: a <textarea>'s content is treated as plain text by the HTML parser, so nothing inside it is ever executed as a script — only the entity decoding itself takes effect.
Is my text sent anywhere?
No. Both encoding and decoding happen entirely client-side in your browser — nothing you type or paste is sent to a server.
Why do angle brackets need HTML encoding?
Characters such as < and > can be interpreted as markup; entities preserve them as visible text when that is the intended result.