HTML Encode

Escape characters that have a special meaning in HTML so your markup examples render as text instead of being interpreted.

  • Runs in your browser
  • Free, no sign-up
Encode
Ctrl + Enter also runs the tool

What this tool gives you

Same as htmlspecialchars

Encodes & < > " and the apostrophe exactly like PHP with ENT_QUOTES.

Optional numeric entities

Turn accents, symbols and emoji into &#NNNN; references for ASCII-only files.

Live preview

The encoded output appears while you type.

Frequently asked questions

When should I HTML-encode?

Whenever untrusted or literal text is placed inside HTML: user comments, code samples, attribute values. It is the primary defence against cross-site scripting.

Why encode the apostrophe?

Attribute values wrapped in single quotes would break otherwise. &#039; is safe in every context and is what PHP htmlspecialchars emits with ENT_QUOTES.

Do I need to encode non-ASCII text?

Not when the page declares UTF-8, which almost every page does today. The option exists for legacy systems, email templates and ASCII-only files.

Is this the same as URL encoding?

No. HTML entities protect text inside markup; percent-encoding protects text inside URLs. Use the URL Encode tool for query strings.

From APIVoid

Need security checks inside your own product?

APIVoid turns the lookups you run here into developer-friendly JSON APIs: IP reputation, URL status and redirects, DNS lookups, SSL info, domain age, screenshots and much more. Simple pricing, 30-day free trial.