HTML Entities Encode and Decode: <, & and Showing Code on a Page

What is it?

HTML Entities Encode / Decode turns characters that mean something in HTML (< > & ") into safe codes like &lt;, and turns codes back into text.

Who is it for?

Bloggers showing code in posts, developers escaping text for HTML, and anyone fixing text full of &amp; and &quot;.

How to use it

  1. Paste the text or code.
  2. Choose Encode or Decode.
  3. Copy the result.

Show code on a Blogger or WordPress post

  1. Choose Encode and paste your code.
  2. Copy the result and paste it in the post’s HTML view, inside <pre><code> … </code></pre>.
  3. Visitors then see the code itself, instead of the browser running it or hiding it.

Options

  • Also encode every non-English character (&#8377; style): turns ₹, é and Hindi into number codes. Only needed for very old systems or emails that mangle Unicode. Modern pages don’t need it.
  • Decode: makes text with &amp;, &quot; or &#39; readable again, for example text copied from a feed or database.

Problems and fixes

  • You see &amp;amp;: the text was encoded twice. Decode it twice.
  • Blogger changed my code: paste encoded code only in HTML view; the Compose view encodes again.

Encoding for display is not the same as making user input safe in your own app: use your framework’s escaping for that.

Open the tool: HTML Entities Encode / Decode

Still stuck?

Contact support. Tell us which tool or page you were using, what you tapped, what you saw, and your phone or computer and browser (for example: Android phone, Chrome). We reply by email.

Questions, or an error not listed here?

Tell us in the comments: what you were doing, the exact message you saw, and your device and browser. We read every comment and add new fixes to this article.