HTML Entity Converter
Encode characters like < > & into HTML entities, or decode named and numeric entities back into readable text. Optionally encode only the five basic characters or every non-ASCII character. All processing happens locally in your browser.
How to use
- Choose "Encode" or "Decode" at the top: encoding turns special characters into entities, decoding restores entities to readable text.
- Encode escapes only the five basic characters < > & " ' by default to keep the output readable; choose "Also encode all non-ASCII" to convert Chinese, emoji and other characters into &#number; numeric entities as well.
- Decode understands common named entities (such as © →) plus decimal and hexadecimal numeric entities; unknown names are kept as-is.
- Use "Swap" to move the result back into the input and switch direction automatically for round-trip checks; "Example" loads demo text.
- All conversion happens locally in your browser: nothing is uploaded, so it is safe to process HTML snippets containing sensitive information.
FAQ
Why is encoding only five basic characters recommended?
What is the difference between named and numeric entities?
Can decoding double-decode or mis-decode content?
Is my content uploaded to a server?
How to use
- Pick encode or decode
Use the chips at the top. Encode turns characters like < > & into entities. Decode resolves named and numeric entities back into readable text.
- Choose the encoding scope
Keep the default Basic five option to escape only < > & and quotes; output stays short and readable. Pick Also encode all non-ASCII to convert Chinese and emoji into numeric entities.
- Paste and convert
Paste your text into the input box and press Encode. The result appears at once in the output area, computed entirely in your browser.
- Round-trip with Swap
Press Swap to move the result back into the input and flip direction. Use it to check that decoding restores your original text before you publish.
- Copy the output
Hit Copy at the top right of the output box. Paste the entities straight into a template, CMS field or code sample.
About this tool
Characters like < and & carry structural meaning in HTML. A browser that reads them literally breaks the page or swallows content. Entities are the safe way to write such characters. Hand-writing them is tedious and error-prone, especially inside attributes or code samples. This converter maps text to entities and back in both directions. It supports the full named-entity table plus decimal and hexadecimal numeric forms. Everything runs locally in your browser, so snippets with sensitive information are safe to process.
Use it to place code examples in blog posts or snippets in CMS rich-text fields. It also helps when a template renders escaped markup as literal text and you need to find out why. Choose the basic-five mode for safe embedding with compact output. Pick the non-ASCII mode to turn Chinese, emoji or accented characters into numeric entities for legacy systems. Run Swap for a round-trip check before you publish.
How it works
Named entities inherit from SGML's entity-reference mechanism. HTML 4.01 defined 252 of them, and HTML5 expanded the table past 2,200 names covering Greek letters, math symbols, arrows and pictographs. Every character also has a numeric form: decimal & and hexadecimal & resolve to the same code point without consulting a name table. That makes numeric references the most portable choice, and entity notation decodes to something semantically identical even though it is longer. XML, kept deliberately minimal, predefines only five entities: the ampersand, the angle brackets and both quotes. This tool's basic mode escapes exactly those five characters.
Order of operations hides a classic trap: the ampersand must be escaped first. Escaping any other character before it turns the newly generated entity names into double entities, and the round trip never returns to the original. Ticking the non-ASCII option pushes Chinese and emoji into hexadecimal numeric entities such as 你, so the whole output lands in the ASCII range. Output like that passes safely through single-byte legacy systems and mail gateways, and decoding walks the tables in reverse to restore every character.
When to use it
- Cleaning scraped text of leftover entities
Crawled body text often carries leftover and & references. One decode pass yields clean prose, ready for tokenization, translation or whatever the pipeline does next.
- Debugging double-escaped CMS content
When a page prints < instead of a bracket, something escaped the stored text twice. Decode the saved value once and compare it with the source; the extra layer shows which template or filter is at fault.
- Feeding Chinese through ASCII-only channels
Legacy interfaces, mail gateways and single-byte databases mangle multi-byte characters silently. Encode all non-ASCII into numeric entities so the data passes through intact, then decode it at the far end.
Tips & tricks
- Stick to the basic-five mode for embedding text in nodes and attributes. It is the shortest output that still cannot break HTML structure.
- Decoding runs a single pass: &lt; becomes < and stops there, so ordinary ampersands in your text are never damaged.
- Unrecognized named entities are left untouched during decoding, so pasting a full page of markup will not mangle the parts it does not know.
Things to watch
- Do not skip quotes in attributes
Text written into an HTML attribute without escaping its quotes terminates the attribute early. The remainder turns into markup and scrambles the page. The basic-five mode already covers both quote characters.
- Entity names are case-sensitive
Á and á are two different characters, and mixing letter cases yields the wrong glyph. If a copied fragment renders literally, check the spelling and case of every entity name first.
- Numeric references need the semicolon
A numeric entity without its trailing semicolon is parsed leniently by some engines and printed literally by others. The same page can look different across browsers, so verify the final character before publishing.