HTML Entity Encoder/Decoder
Convert plain text to HTML-safe entities, or decode HTML entities back to readable text. Uses safe, browser-native encoding/decoding — everything runs locally in your browser.
How to use this HTML entity converter
Paste text into the input box. Click Encode to convert special characters like &, <, >, " and ' into their HTML entity equivalents (for example < becomes <), or click Decode to convert HTML entities back into their literal characters. Both directions use safe, browser-native DOM APIs rather than hand-written replace chains, so the output is always accurate and correctly escaped.
Why HTML entities matter
Browsers interpret certain characters as markup — < and > start and end tags, & starts an entity reference. If you want to display a literal <script> tag as visible text on a web page (instead of having the browser execute it), you must encode it as <script>. This is essential any time user-supplied or code-sample text is rendered inside HTML: forums, documentation sites, comment sections, and code blocks all rely on entity encoding to safely display raw markup without triggering it — and it's also a key defense against cross-site scripting (XSS), since encoded text can never be parsed as an executable tag or attribute.