HTML Entity Encoder/Decoder
Free HTML entity encoder and decoder: escape special characters or turn entities back into text. Runs in your browser.
Raw text
Stays in your browserResult
Shortcuts: Ctrl+Enter run · Ctrl+Shift+C copy result · / search (use ⌘ on Mac)
Next steps
Done here? Use the Send to… menu on the result to carry it on to Text Compare, Emoji & Unicode Escape or HTML to Plain Text.
Free HTML Entity Encoder & Decoder
Convert raw text into safe HTML entities, or decode entities like & and → back into their literal characters. The HTML entity encoder turns special characters into entities and back again. 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.
Worked example
Encoding Tom & Jerry <3 gives Tom & Jerry <3 either way the checkbox is set, since & and < are two of the 5 basic characters. Encoding an arrow character (→) behaves differently depending on the checkbox: left unchecked, it passes through completely untouched; checked, it becomes the numeric → — never the named → form, even though Decode understands that name perfectly.
Common mistakes and edge cases
- Encode and Decode aren't symmetric — in practice, Encode only ever produces the 5 basic entities or numeric references, never a named entity like
→or©, even though Decode fully understands those names. - With "encode non-ASCII" off, any character outside the 5 basic ones (accents, symbols, emoji) passes through completely unencoded — that's expected, not a bug, since those characters are already safe as raw UTF-8 in HTML.