DEVELOPER TOOLS / ONLINE UTILITY

HTML Entity Encoder & Decoder

Convert special characters to HTML entities or decode entities back into readable text for testing and debugging.

FREE ONLINE TOOL

HTML Entity Encoder & Decoder

Runs in your browser
OVERVIEW

What is HTML Entity Encoder & Decoder?

HTML entities represent reserved characters using named or numeric references. For example, an ampersand can be represented as & and a less-than sign as <. Developers use entity encoding when displaying text in HTML contexts, but the correct escaping method depends on where the value is inserted.

What can you use it for?

  • Inspect HTML snippets that contain encoded characters.
  • Prepare sample text for HTML demonstrations and documentation.
  • Decode entity-encoded text copied from a webpage or data source.
  • Check how reserved characters are represented in HTML.

How to use this tool

  1. Paste text containing special characters or HTML entities into the input field.
  2. Choose Encode HTML entities to encode reserved characters.
  3. Choose Decode HTML entities to convert entities back to text.
  4. Copy the output and use it in the appropriate HTML or debugging context.

Example input

Encode this text to see how the ampersand, angle brackets, and quotation marks are represented.

PHP & HTML: <tag attribute="value">

Tips and things to know

  • HTML entity encoding is not a universal substitute for context-aware output escaping.
  • For HTML attributes, JavaScript, CSS, and URLs, use the escaping method appropriate to that context.
  • Encoding does not sanitize input for SQL queries; use prepared statements for database access.

Frequently asked questions

What is an HTML entity?

An HTML entity is a character reference, such as &amp; for an ampersand or &lt; for a less-than sign.

Does HTML entity encoding prevent every XSS issue?

No. Output encoding must match the exact output context. HTML text, attributes, JavaScript, CSS, and URLs have different rules.

Does this tool send my text to a server?

No. Encoding and decoding are performed locally in your browser.