HTML Entity Encoder & Decoder
Encode special characters to HTML entities to make text safe for use in HTML documents, or decode HTML entities back to plain text. All processing happens in your browser — your data never leaves your device.
Named mode uses human-readable entity names like < and > for common symbols, and numeric codes for other characters. Best for readability.
What Are HTML Entities and Why Use Them?
HTML entities are special codes that represent characters in HTML documents. They begin with an ampersand (&) and end with a semicolon (;). For example, the less-than symbol < is written as < in HTML, and the greater-than symbol > is written as >. This prevents browsers from interpreting these characters as HTML markup, which is essential when displaying code snippets, mathematical expressions, or any text that contains reserved symbols.
Common Use Cases
Displaying code in HTML: When you write a tutorial or blog post that includes HTML, JavaScript, or CSS examples, you must escape the angle brackets and ampersands so the browser renders them as text instead of executing them as markup. Our encoder handles this automatically.
Preventing XSS vulnerabilities: Cross-site scripting (XSS) attacks inject malicious scripts into web pages. Encoding user input to HTML entities before displaying it is one of the most effective defenses, because it neutralizes dangerous characters like < and >.
Handling special characters: Characters like curly quotes, em-dashes, currency symbols, and letters with diacritics may not render correctly in all encodings. Converting them to numeric entities ensures they display consistently across browsers, email clients, and content management systems.
Decoding scraped content: When you copy text from a web page's source code, it often contains encoded entities. Decoding them instantly reveals the original readable text without manual lookup.
Named vs. Numeric Entities
Named entities use memorable names like & for &, © for ©, and for a non-breaking space. They are easier to read in source code but only exist for a limited set of characters.
Numeric entities use a number to reference a Unicode code point. Decimal numeric entities look like © and hexadecimal ones look like ©. They work for any character in the Unicode standard, making them universally applicable. Our tool supports both formats when decoding, and lets you choose between named and numeric modes when encoding.
How to Use This Tool
Paste the text you want to encode into the input box, select your preferred mode, and click Encode to Entities. To reverse the process, paste a string containing entities and click Decode from Entities. Use Swap to move the output back to the input for chained operations. Named mode is selected by default and works best for readability.