HTML Entities

Encode and decode HTML text

Loading tool…

About HTML Entity Encoder & Decoder

HTML Entity Encoder & Decoder converts special characters to named or numeric HTML entities and decodes entity text back to characters.

Encoding is useful when text must be displayed as text instead of interpreted as markup. It is context-dependent: HTML text, an HTML attribute, JavaScript, a URL, and a database query each have different escaping rules.

How to use this developer tool

  1. Choose encode or decode mode and paste the text you need to inspect.
  2. Run the conversion and compare characters such as ampersands, quotes, and angle brackets.
  3. Copy the result into the correct output context and apply that context's validation or sanitization rules.

Privacy and data handling

The conversion runs locally in your browser. The result is an encoded representation, not a security review; do not use it as a substitute for context-aware sanitization of untrusted input.

Related developer tools

Frequently asked questions

Does HTML entity encoding sanitize a page?

No. It transforms characters for one HTML context. Safe rendering also requires correct context handling, sanitization, and a safe page architecture.

Why are some characters encoded as numbers?

Numeric entities can represent a character by code point and are useful when a named entity is unavailable or ambiguous.

Should I encode an entire URL with this tool?

No. URLs have their own percent-encoding rules. Use the URL encoder for URL components and complete URIs.