๐Ÿท๏ธ

HTML Encoder / Decoder

Escape special characters to HTML entities and decode entities back into plain text.

Built and maintained by Abdur Rehman ยท Free, no sign-up

Loading HTML Encoder / Decoderโ€ฆ
๐Ÿ”’PrivateRuns in your browser โ€” nothing is uploaded.
โšกFastInstant results, no waiting in queues.
๐Ÿ’ธFreeNo sign-up, no watermark, no limits.
๐Ÿ“ฑAnywhereWorks on phone, tablet and desktop.

How to use the HTML Encoder / Decoder

  1. Paste your text or HTML
  2. Click Encode or Decode
  3. Copy the result

Encode and decode HTML entities

Paste text and click Encode HTML to escape the five special characters โ€” & โ†’ &amp;, < โ†’ &lt;, > โ†’ &gt;, " โ†’ &quot; and ' โ†’ &#39; โ€” or Decode HTML to turn entities back into plain text. Tick โ€œAlso encode non-ASCII charactersโ€ to write ยฉ or emoji as numeric entities such as &#169;.

What are HTML entities?

They are codes that display a character the browser would otherwise treat as markup, or one that is hard to type. Some common ones:

  • Ampersand &amp; ยท less than &lt; ยท greater than &gt;
  • Single quote &#39; (or &apos;) ยท double quote &quot;
  • Non-breaking space &nbsp; ยท ยฉ &copy; ยท โ„ข &trade; ยท โ†’ &rarr;

Why escaping matters

If text typed by users is shown on a page without escaping, someone can inject scripts โ€” a cross-site scripting (XSS) attack. Always escape text before inserting it into HTML; the five characters above are the ones that matter. This page is handy for checking output and for preparing snippets, such as showing code in a blog post.

In code

  • JavaScript โ€” set element.textContent instead of innerHTML, or replace the five characters.
  • PHP โ€” htmlspecialchars($s, ENT_QUOTES); decode with html_entity_decode().
  • C# โ€” WebUtility.HtmlEncode() and HtmlDecode().

๐Ÿ’ป Keep exploring Developer Tools

See all Developer Tools