Codificador/Decodificador HTML

El Codificador HTML convierte caracteres especiales (<, >, &, ", ') a sus entidades HTML correspondientes (&lt;, &gt;, &amp;, &quot;, &#39;) para que se muestren como texto en lugar de ejecutarse como HTML. Útil para escapar contenido de usuario y prevenir XSS.

Cómo usar

  1. 1

    Pega texto/HTML para codificar.

  2. 2

    Ve la versión escapada — segura para mostrar.

  3. 3

    Para decodificar, pega texto con entidades y obtén el HTML original.

Preguntas frecuentes

Ratings & Reviews

Rate this tool

Sign in to rate and review this tool.

Loading reviews…

What HTML Entity Encoding Is

Some characters have special meaning in HTML: < starts a tag, & starts an entity, " delimits attributes. To use these as literal text inside HTML — say you want to display "1 < 2" on a page — they have to be encoded as named or numeric entities: &lt; for <, &amp; for &, &quot; for ".

The Microapp HTML Encoder/Decoder converts in either direction. Encode any text to make it safe for embedding in HTML; decode an HTML string back to readable text. Browser-based, your input never leaves your device.

How to Use It

  1. Paste your text or HTML into the input box.
  2. The encoded (or decoded) version appears instantly in the output.
  3. Use the toggle to switch direction.
  4. Click "Copy" to put the result on your clipboard.
Worked example. Encoding the text <p>Tom & Jerry "rule"!</p>:
&lt;p&gt;Tom &amp; Jerry &quot;rule&quot;!&lt;/p&gt;

This is now safe to paste into HTML — it'll display as the literal text "<p>Tom & Jerry "rule"!</p>" instead of being interpreted as a paragraph tag.

The Most Common Entities

CharacterNamed entityNumeric entityWhen to encode
<&lt;&#60;Always (would otherwise start a tag)
>&gt;&#62;Inside text content (sometimes optional)
&&amp;&#38;Always (would otherwise start an entity)
"&quot;&#34;Inside double-quoted attributes
'&apos; (XML) or &#39;&#39;Inside single-quoted attributes
©&copy;&#169;For older systems that don't render UTF-8
®&reg;&#174;Same as above
&mdash;&#8212;Em dash — preferred when source encoding is uncertain
&nbsp;&#160;Non-breaking space (prevents line break)

When to Encode

User-generated content. If users can submit text that gets displayed on your site (comments, profile bios, forum posts), encoding it before display is the most fundamental XSS defense. Without encoding, a user submitting <script>alert('hi')</script> can run code on every visitor's browser.

Code samples in documentation. Showing HTML code in a docs page means the example HTML must be encoded — otherwise the browser tries to render it instead of displaying it as literal text.

Email templates with dynamic content. User names, dynamic prices, anything personalized — encode before injecting into the template.

Pasting code from one CMS to another. Some CMSes encode angle brackets in code blocks; others don't. Round-tripping content can sometimes leave double-encoded entities (&amp;lt;). Decode first to spot it.

Common Pitfalls

Double-encoding. Encoding an already-encoded string produces nonsense (&amp;lt; instead of &lt;). Decode first if there's any chance the input is already encoded.

Unicode characters and entity equivalents. Modern browsers render UTF-8 directly — you don't need to encode café as caf&eacute;. The named entities exist for legacy compatibility; in 2026, just use the actual characters in UTF-8 source files.

Confusing HTML entities with URL encoding. They're different. HTML entities encode characters for display in HTML. URL encoding (%20 for space, etc.) encodes characters for use in URLs. The two are not interchangeable. Use the URL Encoder/Decoder for URL-specific work.

Apostrophes in HTML vs XML. &apos; is XML-only — it isn't part of HTML 4 (added in HTML5). For maximum compatibility, use &#39; instead of &apos;.

Related Tools

For URL-specific encoding (percent-encoding for query strings and paths), use the URL Encoder/Decoder. To work with binary data encoded as text, the Base64 Encoder/Decoder is the right tool. For converting Markdown to HTML before encoding entities, see the Markdown to HTML converter.