>Fafa Dev Tools

HTML Entity Encoder/Decoder

Encode or decode HTML entities instantly. Free online HTML entity encoder for special characters.

0 chars
Output will appear here...

What is HTML Entity Encoder/Decoder?

HTML entities are special codes that represent characters which have reserved meaning in HTML. For example, < becomes &lt;, > becomes &gt;, and & becomes &amp;. Encoding these characters prevents the browser from interpreting them as HTML tags. This is essential for displaying code snippets, user-generated content, and special symbols safely on web pages.

How to Use

  1. Select Encode or Decode mode using the toggle buttons
  2. Paste or type your text or HTML entities in the input area
  3. The converted result appears instantly in the output panel
  4. Use Swap to reverse the direction and work back and forth

Examples

Encode HTML special characters

Input<div class="hello">Hello & "World"</div>
Output&lt;div class=&quot;hello&quot;&gt;Hello &amp; &quot;World&quot;&lt;/div&gt;

Decode HTML entities

Input&copy; 2024 &mdash; All rights reserved
Output© 2024 — All rights reserved

Frequently Asked Questions

Which characters need to be encoded in HTML?

The five mandatory characters: & (&amp;), < (&lt;), > (&gt;), " (&quot;), and ' (&apos;). The & must always be encoded first to avoid double-encoding. Other special characters like ©, —, and é have named entities but can also be represented as numeric entities (&#169;).

What is the difference between named and numeric entities?

Named entities use descriptive names (&amp;, &lt;, &copy;). Numeric entities use decimal (&#169;) or hex (&#xA9;) code points. Named entities are more readable; numeric entities work for any Unicode character, even those without a named entity.

When should I encode vs decode?

Encode when inserting text into HTML that might contain special characters (user input, code snippets, data from APIs). Decode when extracting text from HTML sources or displaying entity-encoded content as plain text.