Encode and decode HTML entities instantly. Convert special characters like <, >, & to <, >, &.
Common entities: < = <, > = >, & = &, " = ", ' = '
Knexio's HTML Entity Encoder lets you convert special characters to safe HTML entity codes and decode them back — completely in your browser, no data sent to any server. Whether you are writing technical documentation, embedding code in a CMS, or sanitizing content for safe display, this tool handles the conversion instantly with a single click.
Our HTML entity encoder instantly converts special characters to their HTML entity codes and back. Perfect for web developers who need to display HTML code in content management systems, forums, or anywhere raw HTML would be rendered as actual elements. Simply paste your text and click Encode or Decode.
HTML entities are special codes that represent characters in HTML documents. When a web browser reads <, it displays <. This prevents browsers from interpreting special characters as HTML tags, script content, or formatting instructions.
For example, if you write a blog post that includes a code snippet like <div>Hello</div>, the browser would render the <div> tags as actual HTML elements instead of showing them as text. Encoding them as <div> ensures the text displays correctly.
HTML entities follow three formats:
& — human-readable names, supported by all browsers< — numeric value of the character< — hex value of the characterHTML entity encoding is essential in many everyday web development and content creation scenarios:
These five characters have special meaning in HTML and must always be encoded when displayed as text:
< for full protection.In addition to these core five, consider encoding accented characters (é for é) and special symbols (©, ™, €) to ensure cross-platform compatibility.
Encoding: The encoder replaces special HTML characters with their entity equivalents. For example, < becomes <, > becomes >, and & becomes &. This ensures the characters display as text rather than being interpreted as HTML.
Decoding: The decoder reverses the process, converting HTML entities back to their original characters. It handles all named entities (like <) and numeric entities (like <).
HTML entities are used to display special characters that would otherwise be interpreted as HTML code. They're essential for showing code snippets in tutorials, blog posts, or any content where you want to display HTML rather than render it.
The most common characters that require encoding are: & (ampersand), < (less than), > (greater than), " (double quote), and ' (single quote). Other special characters like ©, ®, and € also have entity codes.
Named entities use readable names like < for <. Numeric entities use decimal (<) or hexadecimal (<) representations. Both work the same, but named entities are easier to remember and read in code.
Yes, any Unicode character can be encoded as a numeric HTML entity. For example, the copyright symbol © can be written as © or ©. This is useful for displaying special symbols that might not be supported in all character encodings.
All processing happens locally in your browser. Your text is never sent to any server, making it completely safe for sensitive content, passwords, or confidential code snippets.
This tool is free to use for any purpose. The encoding and decoding logic is straightforward and can be implemented in JavaScript with built-in DOM methods like createElement and innerHTML.
< = < (less than)
> = > (greater than)
& = & (ampersand)
" = " (double quote)
' = ' (single quote)
= (non-breaking space)
© = © (copyright)
® = ® (registered)
Encoding and decoding HTML entities is a common task for developers working with web content. Follow these steps:
You can also swap input and output by clicking the ↔ button to quickly re-process output.
Here's a quick reference table showing the most frequently encoded special characters:
| Character | HTML Entity (named) | HTML Entity (numeric) | Use Case |
|---|---|---|---|
| & | & | & | Ampersand in text or URL |
| < | < | < | Comparison operators in code |
| > | > | > | Comparison operators in code |
| " | " | " | Quotation marks in HTML attributes |
| ' | ' | ' | Apostrophe in attribute values |
|   | Preserving whitespace in HTML | |
| © | © | © | Copyright symbol |
| ™ | ™ | ™ | Trademark symbol |
| ® | ® | ® | Registered trademark |
| ½ | ½ | ½ | Fraction representation |
Named entities (&) are easier to read and remember. Numeric entities (&) are universally supported in all HTML versions.
HTML entities are special codes used to represent characters that have special meaning in HTML, or characters that are not easily typed on a keyboard. They always start with an ampersand (&) and end with a semicolon (;). For example, < represents the less-than symbol (<).
When displaying user-generated content on a web page, encoding HTML entities prevents Cross-Site Scripting (XSS) attacks. If a user types <script>alert('xss')</script>, encoding it ensures the browser displays it as text rather than executing it as code.
Named entities like © are human-readable but only work in HTML5. Numeric entities like © work in all HTML versions. Unicode entities like 😀 (hex) can encode any Unicode character. All three formats are valid and render identically.
No — search engines like Google correctly parse encoded entities and index the underlying text content. Using HTML entities does not harm your SEO rankings. However, for maximum readability in your source code, it's often better to use UTF-8 encoding and avoid unnecessary entity encoding.
Yes. For example, é produces é, and ñ produces ñ. You can also use Unicode hex entities like é for é. The HTML Entity Encoder tool handles all of these automatically.
Cross-Site Scripting (XSS) occurs when an attacker injects malicious scripts into web pages viewed by other users. When you encode HTML entities in user-generated content before displaying it, the browser treats the input as plain text rather than executable HTML or JavaScript. For example, <script> becomes <script>, rendering harmlessly as text. Always encode user input before rendering it on any public-facing page.
No. This tool runs entirely in your browser. Your text is processed locally using JavaScript — it never leaves your device or gets transmitted to any server. This makes it safe for encoding API keys, passwords, or any sensitive strings.
Yes. Paste your complete HTML source into the input box and click Encode. Be aware that pre-encoded entities (like ©) may become double-encoded (&copy;). To avoid this, run a single decode pass first to normalize the content, then encode fresh.
| Entity | Decimal | Hex | Character |
|---|---|---|---|
< | < | < | < |
> | > | > | > |
& | & | & | & |
" | " | " | " |
' | ' | ' | ' |