URL Encode Encode & decode URL strings Find & Replace Search & replace in bulk Text Cleaner Remove formatting & clean text
Mode
Common HTML Entities
& — &
&lt; — <
&gt; — >
&quot; — "
&apos; — '
&nbsp; — non-breaking space
&copy; — ©
&reg; — ®
&mdash; — —
&euro; — €
How It Works
  1. 1Choose Encode or Decode mode in the left panel.
  2. 2Paste your text or HTML into the Input box.
  3. 3The result appears instantly on the right.
  4. 4Use ⇅ Swap to flip input/output, then Copy.

What is HTML Encoding?

HTML encoding converts characters that carry special meaning in markup — <, >, &, and quotes — into HTML entities like &lt;, &gt;, and &amp; that a browser renders as visible text instead of interpreting as code. It matters for two reasons: correctness, because an unencoded < in body text is read as the start of a tag and can break your layout; and security, because encoding user-supplied input before it lands in a page is the baseline defense against XSS (Cross-Site Scripting).

HTML Entities Reference Table

The most commonly used HTML entities, covering reserved characters, symbols, and punctuation:

CharacterEntity nameEntity numberDescription
&&amp;&#38;Ampersand — must always be encoded
<&lt;&#60;Less-than — opens HTML tags if unencoded
>&gt;&#62;Greater-than — closes HTML tags
"&quot;&#34;Double quote — encode inside attributes
'&apos;&#39;Single quote / apostrophe
©&copy;&#169;Copyright symbol
®&reg;&#174;Registered trademark
&euro;&#8364;Euro sign
£&pound;&#163;Pound sterling
&check;&#10003;Check mark
×&times;&#215;Multiplication / close symbol
&rarr;&#8594;Right arrow
&larr;&#8592;Left arrow
&nbsp;&#160;Non-breaking space
&mdash;&#8212;Em dash

How to Use This HTML Encoder / Decoder — Step by Step

The tool has two modes, switchable with the Encode / Decode tabs at the top of the tool card:

  1. Encode mode — Paste any text or HTML markup into the left panel. The tool converts <, >, &, ", and ' into their safe entity equivalents. Use this when you want to display HTML code visually on a web page, or when sanitizing user input before inserting it into a template.
  2. Decode mode — Paste HTML that contains encoded entities (e.g., text you copied from a CMS, an API response, or a database export). The tool converts &lt; back to <, &amp; back to &, and so on — giving you the readable, original text.
  3. Copy the result — Click "Copy result" to copy the output to your clipboard in one click.
  4. Swap input and output — Click "Swap" to move the output back into the input field for further editing or re-encoding in the opposite direction.

Named vs. Numeric Entities

Every entity has two forms. A named entity uses a memorable keyword — &copy; for ©, &mdash; for —. A numeric entity uses the character's Unicode code point in decimal (&#169;) or hexadecimal (&#x00A9;). Both render identically. Named entities read better in source, but only a fixed set of characters has a name; numeric references work for any character, which is why they are the safer choice for obscure symbols and emoji. Note that &apos; (the named form of ') is only valid in XHTML — for the apostrophe in plain HTML, prefer the numeric &#39;, which is exactly what this tool emits in Encode mode.

HTML Encoding vs. URL Encoding

The two are easy to confuse but solve different problems. HTML encoding produces entities like &lt; so a character is safe inside an HTML document. URL encoding produces percent sequences — a space becomes %20, & becomes %26 — so a value survives intact inside a URL or query string. Encoding HTML where you needed a URL (or vice versa) produces text that looks escaped but breaks at the wrong layer. If you need the URL version, use the URL Encode / Decode tool.

Related Tools

Frequently Asked Questions

Why does encoding only escape five characters and not everything?

For valid HTML you only need to neutralize the characters the parser treats as syntax: &, <, and > in text, plus " and ' when the value sits inside an attribute. Everything else — letters, digits, accented characters, emoji — is legal as-is in a UTF-8 document. This tool encodes exactly those five (escaping & first so existing entities aren't double-encoded), which is enough to render code as text and to block XSS in element content.

Will decoding turn &amp;lt; back into a real tag?

No, and that is correct behavior. Decoding reverses one layer: &amp;lt; decodes to &lt;, not to <. The doubled &amp; means the text was encoded twice (double-encoding), so it takes two decode passes to recover the original. Run Decode again — or use the Swap button to feed the output back in — if you still see stray &amp; sequences.

Is HTML encoding alone enough to stop every XSS attack?

No. Entity encoding protects values placed in element content and quoted attributes, but it does not make user input safe inside a <script> block, a style attribute, an href/src URL, or an inline event handler — those contexts need their own escaping or an allow-list. Treat this tool as the text-context layer of a broader output-encoding strategy, not a complete XSS fix.

Why did &nbsp; become a normal space when I decoded?

Decode mode resolves &nbsp; to its real character: U+00A0, the non-breaking space. It looks like an ordinary space in a textarea but is a distinct code point, which is why a "space" copied from a web page sometimes won't match a regular space in search-and-replace. Re-encode the text and it returns to &nbsp;.