← Back to DevKit

HTML Entity Encoder / Decoder

HTML ENTITIES · ENCODE & SECURITY

Escape < > & " ' to entities or restore &lt;div&gt; and &#65; back to text — a staple for debugging front-end templates.

Text → HTML entities (encode)
HTML entities → text (decode)

>_ USAGE GUIDE

Two-way conversion: turn < > & " ' into HTML entities, or restore &lt;div&gt; and &#65; back to plain characters. Named entities (&amp;, &nbsp;) and numeric entities in decimal or hex form (&#65;, &#x41;) are both recognized on decode.

  1. Encode: paste raw text and the escaped version appears in real time, safe to embed in any HTML page
  2. Decode: paste escaped markup and recover the original characters, including numeric forms
  3. Verify round trips: paste the decoded output back in to confirm nothing was double-escaped

Typical scenarios: showing code snippets on a blog or documentation page (unescaped < would be executed as a tag), debugging escaping issues in front-end templates, and auditing the HTML produced by rich-text editors. A useful debugging habit: paste a template's rendered output, encode it, and compare with the original source — any spot where escaping happened twice, such as a visible &amp;lt; on the page, shows up immediately. Conversion runs locally in real time with zero uploads — content never leaves your device.

>_ FAQ

Q1 · What do &lt; and &amp; mean?

In HTML, characters like < and & carry special meaning — they start tags and entities. Entity notation writes them safely as &name; or &#number;: &lt; is < (less than), &amp; is &, and &nbsp; is a non-breaking space. When you view page source and see many &lt; sequences, that is code that has been escaped for display.

Q2 · Why does the code I paste into a webpage never display correctly?

The browser parses <div> as an element, not as text. To display code as-is, <, >, and & must be escaped into entities — which is exactly what the encode direction of this tool does. Blog posts and CMS rich-text fields need this step (many Markdown renderers do it automatically; plain HTML environments do not).

Q3 · What is the difference between &nbsp; and a normal space?

&nbsp; is a non-breaking space: the layout engine will not wrap a line there, and consecutive occurrences are not collapsed into one. It keeps "3 km" from splitting across lines and aligns form fields. Regular spaces collapse — several in a row render as one — which is the most common source of spacing confusion in HTML.

Q4 · Why are &#65; and &#x41; the same character?

Decimal 65 and hexadecimal 41 are both the Unicode code point of the letter A. Every character has up to three entity forms — a named entity when one is defined, decimal, and hex — and they are fully equivalent. Hex notation is more common in bulk character-to-entity output. Decode either form here to confirm.

Q5 · When must characters be escaped, and when can they stay?

Rules of thumb: an & in text must become &amp; (otherwise it may be read as the start of an entity); a < in text must be escaped (it starts a tag); a > technically may stay but escaping it is good practice; quotes inside attribute values must be escaped when they match the wrapping quote. When unsure, escape everything — redundant escaping never changes rendering.

Embed code

Paste the code below into your page to embed this tool as an iframe (nav and footer auto-hidden).

Heightpx
This tool runs entirely in your browser — input never leaves your device. Press Ctrl K to switch tools anytime.