Skip to content

HTML Entity Encoder / Decoder

Named · decimal · hex — XSS-safe escaping · 100% client-side

Live

Appearance

Accent color

Font size

Layout density

Preferences are saved on this device for the entity tool only.

0 chars · 0 B
Escaped output 0 chars · 0 B
Entity cheat sheet Click Copy or Insert — respects your selected format
0input chars
0input bytes
0output bytes
0%size change
0entities
Free Forever Named · Decimal · Hex XSS-safe escaping

HTML Entity Encoder & Decoder — escape anything

Turn <, >, & and quotes into safe entities — or decode them back to characters. Named, decimal, and hex formats.

The basics

One character, three ways to write it

Every entity — named, decimal, or hexadecimal — renders as the exact same glyph in the browser.

Named entity

&amp;

Readable — preferred in markup

Decimal entity

&#38;

Universal — works everywhere

Hex entity

&#x26;

Compact — developer favorite

All render as

&

Ampersand · U+0026

Why it matters

Three reasons escaping isn’t optional

Render code correctly

Paste a <div> into a page without entities and the browser renders it — your tutorial becomes invisible markup. Escaping turns markup into displayable text.

Defuse injection attacks

Escaping user-generated content is the primary defense against stored XSS: <script> becomes harmless &lt;script&gt; text instead of executable code.

Pass HTML validation

A raw & in an attribute or URL makes your markup invalid. Proper entities keep documents well-formed for browsers, parsers, and crawlers.

Quick reference

The essential entity cheat sheet

Twelve entities cover 95% of everyday markup escaping.

Char Name Named Decimal Hex Use for
& Ampersand &amp; &#38; &#x26; Must escape — always
< Less than &lt; &#60; &#x3C; Must escape in content
> Greater than &gt; &#62; &#x3E; Escape in content
" Double quote &quot; &#34; &#x22; Escape in attributes
' Apostrophe &apos; &#39; &#x27; Escape in attributes
␣ Non-breaking space &nbsp; &#160; &#xA0; Prevents line breaks
© Copyright &copy; &#169; &#xA9; Legal notices
® Registered &reg; &#174; &#xAE; Trademarks
™ Trademark &trade; &#8482; &#x2122; Brand marks
€ Euro &euro; &#8364; &#x20AC; Pricing
— Em dash &mdash; &#8212; &#x2014; Typography
× Multiplication &times; &#215; &#xD7; Math & dimensions

How to use

Escape in four steps

From raw markup to safe entities in seconds — no server round-trips, no accounts, no limits.

  1. 1

    Paste your text or markup

    Drop in plain text with special characters — or a chunk of HTML entities you want decoded back to readable form.

  2. 2

    Choose your entity format

    Pick named (&amp;), decimal (&#38;), or hexadecimal (&#x26;) output. All three render identically in browsers.

  3. 3

    Get instant output

    The conversion happens live in your browser — no submit, no server, no delay. Reserved characters are handled automatically.

  4. 4

    Copy and paste into your code

    One click copies the escaped result, ready for your markup, template, feed, or documentation.

Use cases

Where entities earn their keep

Anywhere a character could be mistaken for markup — or mangled by a parser.

Code snippets in articles

Publishing HTML, JSX, or XML examples? Encode the markup so readers see the tags instead of rendering them.

User-generated content

Comments, forum posts, and reviews must be entity-escaped before rendering — the front line of XSS prevention.

Meta tags & attributes

Quotes and ampersands inside attribute values — titles, alt text, hrefs — need escaping or they terminate the attribute early.

Email templates

Older email clients mangle raw special characters. Entities make typographic symbols bulletproof across clients.

Sitemaps & feeds

XML sitemaps and RSS feeds require escaped &, <, and > inside <loc> and <title> — unescaped characters break parsing.

SEO-safe symbols

Entities let you use ™, ©, and — in titles and descriptions without charset headaches on legacy platforms.

Deep dive

Named vs. numeric entities

Same rendered output, different trade-offs in your source.

&named;

Human-friendly
  • Self-documenting — &copy; reads as © at a glance
  • Limited to the ~250 names in the HTML5 spec
  • Preferred for hand-edited markup and documentation

&#numeric;

Universal
  • Covers every Unicode codepoint — no exceptions
  • Decimal (&#169;) or hex (&#xA9;) — both valid
  • Best for programmatic escaping and rare symbols

FAQ

Entity questions, answered

What is an HTML entity?

An HTML entity is a text sequence that represents a character: it starts with & and ends with ;. Entities exist for two reasons — reserved characters like < and & would otherwise be parsed as markup, and hard-to-type symbols like © or — can be written in plain ASCII. Browsers decode entities back to the real character when rendering.

Should I use named or numeric entities?

Named entities (&amp;, &lt;, &copy;) are readable and self-documenting — use them when a name exists. Numeric entities (&#38; or &#x26;) cover every Unicode codepoint, including characters with no name. Functionally identical; pick named for common characters and numeric for rare ones.

Which characters must always be escaped?

The ampersand & — always, since it starts every entity. Less-than < and greater-than > — in text content and attributes. Double and single quotes — inside attribute values that use that quote style. Everything else is optional in UTF-8 documents but often worth escaping for clarity.

Do HTML entities prevent XSS?

Entity encoding output is a core XSS defense: escaping <, >, &, and quotes in user content converts injected markup into inert text. It’s necessary but not sufficient alone — context-aware escaping, Content Security Policy, and sanitizing rich text all play a role. This tool handles the escaping step.

If my page is UTF-8, do I still need entities?

For the five reserved characters (& < > " and quotes in attributes), yes — charset doesn’t matter, they’re structural. For everything else, UTF-8 lets you write © or — directly. Entities remain useful when editing in ASCII-only tools, templating languages, or legacy systems with unreliable charsets.

Does entity encoding affect SEO?

Entities render identically to raw characters, so Google reads &copy; and © the same way. Where it helps indirectly: escaped markup in your content doesn’t accidentally render, valid HTML parses more reliably, and properly escaped titles/snippets display correctly in SERPs and social previews.

Is my text uploaded anywhere?

No. Encoding and decoding run entirely in your browser with zero network requests. Paste production markup, internal templates, or unreleased content freely — it never leaves the tab and is gone when you close it.

<your_markup/> → safe

Make your markup bulletproof

Escape reserved characters before they break your layout — or your security posture. Free, instant, and completely private.