Skip to content

HTML Entity Encoder

Convert characters to HTML entities and back for safe embedding in markup.

Output

How to use the HTML Entity Encoder

  1. Choose Encode or Decode.

  2. Paste your HTML or text.

  3. Copy the safe output.

What is HTML entity encoding?

HTML entities let you display reserved characters (< > & " ') as text instead of having the browser interpret them as markup — essential for safely showing code or user content and preventing broken layouts. This tool encodes those characters to named or numeric entities and decodes entities back to their original characters.

Key features

  • Encode reserved HTML characters to entities
  • Decode named and numeric entities
  • Great for displaying code samples safely
  • Runs locally in your browser

Frequently asked questions

Which characters get encoded?

The reserved characters &, <, >, double-quote and single-quote, which is enough to safely embed text in HTML.

Does this prevent XSS?

Entity-encoding untrusted text before inserting it into HTML is a key XSS defence, but always combine it with context-aware escaping in your app.

Can it decode numeric entities?

Yes — both named (&amp;) and numeric (&#38;) entities decode back to their characters.