Back to public tools
All tools
Browser utility

HTML Entity Encoder and Decoder

Turn characters like & and < into HTML entities, or turn entities like &amp; back into readable text.

Your inputs stay in your browser.

Escape or unescape HTML text

Choose Encode or Decode, paste your text, then select Convert text. You can copy or download the result below.

Decoded results always appear as plain text. You can paste or load up to 2 MiB of text at a time.

Advanced settings

Encoding style and selected characters

Context helpers also escape required delimiters, even if your custom set omits them. Attribute helpers use a fixed data-value name and return plain text. Line breaks and tabs are numeric; unsupported controls are refused instead of assuming browser parser behavior.

Unicode and round-trip review

Encoding compares strict decoding with your original text. Decoding separates literal spelling changes from semantic text equality; aliases can differ without changing characters.

Find a named HTML entity

Batch UTF-8 text files

Choose up to twenty files, 2 MiB each and 10 MiB together. Files are treated as plain UTF-8 text; HTML is never parsed. A UTF-8 BOM is removed and reported. Output follows the same current direction and options.

0 files selected.

Paste text, choose a direction, then Convert text.

Text, files and results stay in this browser. Undo retains one previous draft in this tab; there is no automatic persistence. Named-entity data attribution and license.

How to use HTML Entity Encoder and Decoder

Choose Encode plain text or Decode references, paste your Source text, then Convert text. The complete result is plain text: no HTML preview is created. Copy it, save a text file or download a conversion review. Swap input and output changes direction and keeps one-step Undo available. Clear and Try an example also keep one previous draft.

The default encoder replaces ampersands, angle brackets, double quotes and apostrophes. Open Advanced settings for decimal references such as &#169;, hexadecimal references such as &#x1F600;, special characters plus all non-ASCII, every character, or a custom set of up to 256 Unicode scalar characters. Named style uses a single-character name when available and decimal references otherwise. Selected zero or lone surrogate values cannot become supported strict references.

HTML value context adds required escaping even when your custom selection omits a delimiter. Text content, double-quoted attributes and single-quoted attributes have different requirements. Attribute helpers return a fixed data-value fragment as plain text, with tabs and line breaks encoded numerically. Unsupported controls are refused. This is for text and quoted values, not arbitrary markup, event handlers, script, CSS or URL safety.

Decoding is strict and happens once. Names need a semicolon and are case-sensitive; unknown or unsupported references stay literal. Numeric references support U+0001 through U+10FFFF except surrogate values, without browser legacy numeric remapping. For example, &amp;lt; becomes &lt;, rather than a less-than sign after repeated decoding.

Open the reference review to see highlighted unknown tokens, their reason and zero-based UTF-16/code-point positions. Select issue highlights that range in the relevant input or output field. The first fifty detailed rows appear on screen, and the report holds at most one thousand. Candidate previews are at most 42 UTF-16 units. Coverage is explicit; the complete converted text is never truncated.

The named lookup searches all 2,125 semicolon-terminated standard names offline, including aliases and names representing two code points. Search a name, a character or a U+ code point. At most thirty matching names are shown, with the total count; refine the search for others. Use a reference as input, or copy its name.

Choose input or output for the Unicode inspector. It shows the first hundred code points with hexadecimal/decimal values, UTF-16 offsets and lengths, UTF-8 byte counts and scalar validity. Code points are not grapheme clusters: an emoji sequence or combining character can occupy several rows. Lone UTF-16 surrogates change to replacement characters in UTF-8 output.

Enable Compare the round trip for an extra check. Encoding is compared with strict decoding back to the original text. For decoding, literal spellings and semantic character equality are separate: &copy; and &#169; can describe the same character while looking different. A result with a changed literal form is not automatically a failed semantic round trip.

For batches, choose up to twenty plain UTF-8 text files, at most 2 MiB each and 10 MiB together. Current direction/options apply to each file. A UTF-8 BOM is removed and recorded; malformed UTF-8 or unsupported input has a per-file error. Save successful text files individually or in a ZIP with a complete per-file report. Combined text output is capped at 20 MiB; failed files do not enter the ZIP.

Closing Advanced settings preserves choices and results, with custom options indicated and errors outside the group. Reset restores optional defaults while keeping direction, source and chosen files. Editing conversion inputs invalidates old results. Cancel stops the owned worker and retains the draft for retry. Undo keeps one previous draft in this tab; nothing is automatically persisted or uploaded.

Example: keep a quotation inside an HTML attribute

Enter Tom & "Mia" as source text. Choose Encode, open Advanced settings and select a double-quoted attribute value. Convert text. The default result is Tom &amp; &quot;Mia&quot;, with a plain-text helper fragment that places it inside a quoted data-value.

The quoted delimiters are escaped, but the helper does not decide whether another attribute name, a URL, a script or a later HTML insertion is appropriate. Keep the result as text until you place it in the intended valid HTML context.

About HTML character references and Unicode

HTML character references represent characters using named spellings or numeric code points. An ampersand begins the reference and a semicolon ends the strict form used here. Multiple named spellings can represent the same character, and some names represent two code points.

Unicode code points describe character values; UTF-16 and UTF-8 describe encodings. A character outside the basic multilingual plane uses two UTF-16 code units, while its UTF-8 representation may use four bytes. Combining sequences and emoji can contain several code points that appear as one visible symbol.

Browsers have additional compatibility rules when parsing HTML, including some missing-semicolon handling and numeric remapping. This tool deliberately preserves its strict plain-text policy instead of simulating an HTML parser. Encoding characters is not the same as sanitizing a complete document.

The offline name table comes from the WHATWG HTML standard. Attribution, source snapshot and license are included. Your text and files are processed locally; using the lookup makes no request to the source website.

Stars and feedback

Loading…

Tool reference #140