Encode special characters to HTML entities online with Calzyra. Convert symbols such as &, <, > and quotes into HTML entity codes, then copy the result.
Encoded HTML entities will appear here
Paste text in the input panel and it encodes automatically
Load sample data to get started
What this tool can do
Five Reserved Characters
Ampersand, angle brackets, double quote and apostrophe become entities
No Double Encoding
The ampersand is escaped first, so generated entities stay intact
Ordinary Text Untouched
Letters, numbers and safe punctuation pass through unchanged
Unicode Preserved
Accents, symbols and emoji are copied through as written
Encodes as You Type
The output updates while you edit, and Ctrl+Enter forces a re-run
Copy Output
One click puts the encoded result on your clipboard
Clear Both Panels
Reset the input and the output in a single step
Dark Mode
Easy on the eyes for long sessions
Methodology and approach
The encoder replaces &, <, >, " and ' with &, <, >, " and ' in one pass, escaping the ampersand before any new reference exists - so an entity written by the encoder is never encoded a second time. Every other character, including accents and emoji, is copied through untouched.
Paste the text you want to convert into the input panel on the left and click Encode HTML Entities - the whole job of encoding special characters to HTML entities online in one paste, one click and one copy. The encoded result appears in the output panel on the right, with a status line above it reporting how many reserved characters were replaced.
The workspace also updates on its own: edit the input and the encoded output follows a moment later, so you can see the effect of a change without pressing anything. Ctrl+Enter forces a re-run at once, Copy puts only the encoded result on the clipboard - never the untouched input - and Clear empties both panels. The conversion happens in your browser; the text you paste is not sent anywhere.
When the text contains none of the reserved characters, the output matches the input exactly and the status line says so. That is a useful result rather than an error: it tells you the string needed no encoding for the position it is going into.
Tom & Jerry <tag> "Hello"Tom & Jerry <tag> "Hello"HTML entities let a character be written as a reference instead of the raw character: an ampersand becomes &, a less-than sign becomes <, and a double quote becomes ". Every reference starts with an ampersand and ends with a semicolon, and a browser reading the page replaces it with the character it names before anything is displayed.
An HTML entity encoder online is the tool that performs that rewrite for you. It matters because two of those characters are structural: an ampersand opens every entity reference, so a stray one in running text can swallow the characters that follow it, and a less-than sign starts a tag, so text containing <tag> in a paragraph is read as markup rather than shown as characters. Escaping both is what turns content back into content.
The word encoder also separates this page from its neighbours. A decoder reads references and returns the characters they stand for, while the HTML Formatter and HTML Validator reorganise or check markup rather than escaping text.
Ampersand (& becomes &) is the one that is never optional. Every entity reference begins with an ampersand, so an unescaped one in running text can be read as the start of a reference and eat the characters that follow - and it is the character this encoder replaces first, for exactly that reason.
Less-than (<) and greater-than (>) follow. The less-than is structural - it opens a tag - so text such as 5 < 10 would otherwise be read as an unfinished tag. The greater-than does not start anything in HTML, but escaping it alongside the less-than keeps angle-bracket pairs consistent, and this tool does it by default.
Double quotation mark (") and apostrophe (') are the two that matter inside attribute values: a quote that matches the delimiter ends the attribute early. This tool writes the apostrophe as the numeric reference ', which is a valid decimal character reference in HTML5; the named form ' belongs to XML and XHTML rather than to HTML 4, so the numeric form is the one that works everywhere.
Those five - &, <, >, " and ' - are the HTML reserved characters, and a reserved characters encoder such as this one replaces exactly them. Text content needs the ampersand and the less-than escaped, an attribute value also needs whichever quote character delimits it, and escaping all five means one result is valid in either position. Ordinary letters, digits, spaces, commas, periods, emoji and accented characters need no reference in a UTF-8 document, so they pass through exactly as they were typed.
5 < 10 & 10 > 55 < 10 & 10 > 5Example 2 - text containing an ampersand. Input: Research & Development. Output: Research & Development. The ampersand is the only reserved character in the string, so it is the only character that changes.
Example 3 - HTML-like text kept as text. Input: <h1>Hello</h1>. Output: <h1>Hello</h1>. The angle brackets are what the browser would otherwise read as an h1 element; after encoding they are ordinary characters, and the line displays as markup instead of becoming markup.
Both results are produced by this page's encoder rather than typed by hand, so the strings above are exactly what the output panel shows when you load the example from the toolbar.
Placing user-written text into a template, a CMS field or a static page, where an ampersand or a stray < would otherwise be parsed. Building an attribute value from a string that may contain quotes, for example a title carrying an apostrophe. Showing HTML as text - documentation, a tutorial, a code listing inside a paragraph - where the angle brackets must be visible rather than active. Escaping text inside an email body or an RSS description, both of which are HTML.
It is also a step in preparing content for systems that are strict about markup, and a quick check when a page shows garbled characters where an ampersand should be: that symptom is almost always an ampersand that was never encoded. It is the wrong tool when the goal is the reverse - reading references back as characters, which is the HTML Entity Decoder's job - or when the surrounding markup itself needs tidying or checking, which belongs to the HTML Formatter and the HTML Validator.
Context decides what is safe. This encoder escapes the five reserved characters everywhere, which is correct in text content and in attribute values, but JavaScript string literals, CSS values and URL query strings each have their own escaping rules; text bound for those positions still needs the escaping that its context calls for.
Encoding is also not a security guarantee on its own. Escaping a reserved character so it displays rather than parses is a real and necessary step, but sanitising what a page is allowed to contain is a separate concern, and a string that is safe as HTML text can still be misused elsewhere.
Two details of this tool are worth knowing before you rely on it. It does not produce numeric character references for non-ASCII characters - accents, symbols and emoji are copied through as they are, which is the correct result for a UTF-8 document - and it escapes rather than validates, so it never reports a problem with the text, only the reference it wrote. Applying it twice is the one mistake that visibly breaks the result: encoding already-encoded text turns the ampersand of & into &amp;, so always encode from the original string.
Common questions about this tool