&

HTML Entity Encoder / Decoder

Convert special characters to HTML entities and back. Supports named (&), numeric (&), and hex (&) formats.

Plain Text
HTML Entities
Common Entities — click to insert
Advertisement
About this HTML entity encoder

This HTML entity encoder and decoder converts special characters to their HTML entity equivalents and back, instantly and entirely in your browser. Switch between named, decimal, and hex output, and click any reference character to drop it straight into your text.

In HTML, a handful of characters carry special meaning to the parser. An ampersand begins an entity, an angle bracket opens a tag, and a quote can close an attribute early. If those characters appear in your content as literal text, the browser may misread them and break your layout — or worse, run code that was never meant to run. Encoding replaces each reserved character with a safe entity such as < or &, so it renders as plain text instead of markup. Decoding reverses the process, turning entities back into the original characters. This tool handles the four critical reserved characters plus dozens of symbols, accented letters, currency signs, and Greek letters, and it supports named entities, decimal codepoints, and hexadecimal codepoints alike. People use it to:

Everything runs locally in your browser using plain JavaScript, so nothing you paste is ever uploaded or stored on a server. The text you encode or decode stays entirely on your own device, which makes the tool safe for snippets, private content, and anything you would rather not send across the network.

How to use
  1. Choose Encode to turn raw text into HTML-safe entities, or Decode to do the reverse.
  2. Pick the entity format: Named (&), Decimal (&), or Hex (&).
  3. Type or paste into the left pane — the result appears live on the right as you type.
  4. Click any character in the reference grid to insert its entity directly into your text.
  5. Use Copy or Download to save the output, or Swap to feed it back as new input.
FAQ

The reserved HTML characters &, <, >, ", and ' are always encoded, plus any character above codepoint 127 (non-ASCII). ASCII letters, digits, and punctuation are left alone.

When applied at render time to all user-supplied output, yes — encoding turns injected <script> tags into visible text. Context matters though: strings inside JS, CSS, or URLs need different encodings.

All three represent the ampersand. &amp; is the named entity, &#38; is decimal, and &#x26; is hex. Named entities are most readable; numeric forms work even when a parser does not know the named version.

An HTML entity is a short code that stands in for a character so the browser displays it as text instead of treating it as markup. Each entity starts with an ampersand and ends with a semicolon, for example &lt; renders a literal less-than sign. Entities let you show reserved characters, symbols, and accented letters reliably across browsers.

A named entity uses a memorable word such as &copy; for the copyright sign, while a numeric entity uses the character codepoint as a decimal value like &#169; or hex like &#xA9;. Named entities read more clearly, but only a limited set of names exists; numeric entities can represent any character and always work, even for symbols without a name.

Escaping user input is the core defence against cross-site scripting. If you place text from a form or URL straight into a page, an attacker can inject a <script> tag that runs in your visitors' browsers. Encoding that text first turns the tag into harmless visible characters, so the malicious code is shown rather than executed.

The four reserved characters are the ampersand, the less-than sign, the greater-than sign, and the double quote, encoded as &amp;, &lt;, &gt;, and &quot;. The ampersand must come first when escaping so existing entities are not double-encoded. Inside attributes the single quote is often escaped too, and this tool handles all of them plus many extra symbols.