HTML Entity Encoder

Encode special HTML characters into entities or decode entities back into text. Escape special characters such as ampersands, angle brackets, quotation marks and apostrophes into HTML entities, or decode common/numeric entities back into text.

Input and options

Ready. Results update as you type.

Result

Input length / items0
Output length / items0

How to Use the HTML Entity Encoder

  • Enter or paste your input in the text area, or choose an available input control.
  • Select the conversion or formatting options that match your task.
  • Review the result and the status message for errors or confirmation.
  • Use Copy result or Download .txt to save the output.

About the HTML Entity Encoder

Escape special characters such as ampersands, angle brackets, quotation marks and apostrophes into HTML entities, or decode common/numeric entities back into text.

This free developer utility is designed for desktop, tablet and mobile screens. It uses the MohakTools centralized theme styles and shared site header and footer scripts.

Common questions about HTML Entity Encoder

Which characters are encoded?

Ampersands and angle brackets are always encoded; quotation marks can also be encoded using the option.

Can I decode HTML entities?

Yes. Choose Decode HTML entities to turn entity references back into text.

Does encoding sanitize all HTML?

No. Entity encoding is not a complete HTML sanitization strategy for every context.

When should I encode HTML entities?

When displaying user text inside a page, so a typed < or & appears as a character instead of being read as markup.

Does it prevent SQL injection?

No. Entity encoding protects HTML rendering, not database queries. Use parameterised queries for that.

What is the difference between &amp; and &#38;?

The first is a named entity, the second a numeric one. Both render the same character; numeric entities work for any code point, named ones only for the ones with a name.

Explore Related Tools

Continue with other MohakTools developer utilities.

Privacy note: processing runs in your browser. Avoid entering confidential data on shared or untrusted devices.