Select Encode special characters when literal ampersands, angle brackets, or quotes need to be written as character references. This is useful in an HTML code example or a plain text value that needs to remain visible in markup. This operation is not a general-purpose sanitizer.
Decode one layer at a time
Choose Decode character references for input such as < or é. Use complete references ending in a semicolon. An unknown reference remains text. If an ampersand was encoded twice, inspect the result before running another pass.
Use the right tool for the representation
HTML character references are different from %26 in a URL value. Use the URL component encoder for that job. If formatting came from a rich-text clipboard rather than literal tags, start with the plain text converter. Decoding markup does not make it safe to insert into a web page.
Encode and decode literal text for an HTML context
Choose the operation based on what the HTML should display
Start with the text a reader should see. Suppose a code sample needs to display the literal characters less-than, em and greater-than, rather than turning them into an emphasis element. A text node in HTML source needs a representation that the HTML parser will read as those visible characters. Encoding special characters supplies that representation. If your source already contains character references and you want ordinary text, choose the decoding direction instead.
The tool does not remove formatting from a rich clipboard, render a page or validate a whole document. If the source is a copied paragraph from a formatted editor, use Convert to plain text first and check what the clipboard actually supplied. If you already see literal angle brackets in a textarea, they are already text in that context. There is no reason to encode them until a destination specifically needs HTML source.
Keep the distinction between text and markup explicit when working with examples. A heading written in HTML source and a heading pasted into a word processor can look identical on screen but require different representations. Ask whether the destination wants a text value, a code example or HTML that will render before deciding which form to copy.
Try a literal example with ampersands and angle brackets
Paste this example into Original and choose Encode special characters. It represents a product label containing an ampersand and the text of a tag name, not an instruction to create a real tag.
Tea & coffee <ready>
The result uses references for the ampersand and the angle brackets. In HTML source, a parser interpreting that result in ordinary text can display the original phrase. If you paste the encoded result into a plain-text field, you will see the references themselves because that field does not interpret HTML. This difference is useful when checking a handoff: compare both the stored representation and what a reader will see.
Now switch to Decode character references and try the encoded output. One pass should restore the original phrase. If you accidentally encode it twice, a single decode restores the first encoded layer, not the final visible text. Keep the original example and compare each layer separately. A quick round trip is a good check that you understand which output belongs in which context.
Recognize named, decimal and hexadecimal references
A reference can be named, such as the HTML spelling for an ampersand, or numeric, such as é or é for é. The numeric forms describe a character using decimal or hexadecimal digits. Different valid reference spellings can decode to the same visible value. Decoding does not try to remember which spelling the source used, so re-encoding is not a reliable way to reproduce the exact markup.
Use complete references ending in a semicolon with this utility. An unknown reference stays text. If an input does not decode, verify that you copied the leading ampersand, the name or number and the final semicolon. Do not rewrite every ampersand as a character reference just to make a sample look uniform. Some values contain literal punctuation that is already in the form the recipient expects.
When inspecting a less common reference, compare a very small example rather than decoding a whole document first. A reference may produce a nonbreaking space or a combining mark that is hard to see. Use the invisible character inspector on the decoded result if you need to confirm the character rather than trusting its appearance.
Decide whether a second layer is intentional
If your source contains the characters &lt;, one decode returns the characters <. A second returns a literal less-than sign. Which of these is right depends on the destination. An article explaining HTML entities may intentionally want the reader to see the reference, not the decoded symbol. A text field that receives a mistakenly double-encoded label may instead need the plain character.
Identify which system introduced each layer. A template can escape a value automatically, so pre-encoding it manually can leave the displayed reference visible. If your framework accepts an ordinary text value and escapes it for you, provide the literal value. If you are deliberately writing an example in HTML source, inspect the actual source and the rendered preview to verify that you have the right number of layers.
Do not keep decoding until the text stops changing. That can alter meaningful example text and turn an intended literal representation into markup-looking content. Decode one step, inspect the result, then decide whether another step is appropriate. For a handoff, say which representation you are sending: literal text, an HTML reference or markup intended to be rendered.
Do not reuse HTML text escaping in an unrelated context
A value placed in a text node, a quoted attribute, a URL parameter and a script does not always need the same treatment. This utility encodes common HTML special characters; it is not a context-aware template engine and is not a sanitizer. In an application, prefer the platform's safe text insertion or context-specific escaping rather than building markup by combining raw strings. Decoding content does not make arbitrary markup safe to render.
Percent escapes are a different representation. A percent-encoded ampersand in a URL value belongs to that value and should not split a query into two parameters. An HTML reference represents a character to an HTML parser. Use the URL component encoder for an individual URL value. If a URL appears inside HTML source, you may have to consider both the URL and the enclosing HTML context; do not encode the whole URL as though it were a single query value.
JSON also has its own string escaping. Do not replace quotation marks in a JSON document with HTML references to make it parse. The JSON formatter can help diagnose its syntax. To display JSON as an example on a page, keep the machine-readable original and prepare a separate representation for the page.
Verify both the stored source and the rendered result
Try the exact workflow the recipient will use. If they will paste the result into HTML source, check that the browser displays the literal punctuation you expect. If they will paste into a plain-text field, check that they get the original visible characters rather than a string of reference names. For a demo, use invented examples instead of copying a private document into a public preview.
For code documentation, keep the source example and a rendered preview next to each other while you test. Look at an ampersand and a quotation mark, not just letters. Inspect whether code-like text is shown as text rather than interpreted as a tag. If the page builder or rich-text editor applies another encoding step, test a small example first to see what the builder actually stores.
Use the guide to preparing structured text when the same data needs a machine version, a documentation table and an HTML example. Save each representation separately and name it for its use. A clean result in one context can be wrong in another without any conversion error.
Check link labels and pasted entities before handing off
If a document contains visible words such as Research & Development, determine whether the data already contains an ordinary ampersand or the characters of an entity. The safe choice for an HTML example depends on that starting point. If the result differs only after previewing it on a specific publishing platform, compare the clipboard value, the stored source and the rendered label. The first point where they diverge identifies the layer to correct. Preserve the original wording instead of asking another person to decode whichever version happens to look the most plausible.
Keep a precise reference example for troubleshooting
If a label renders differently across two systems, record the exact reference and the character you expected. A numeric reference written in hexadecimal and one written in decimal can display the same result, so compare the decoded character rather than just their spellings. Conversely, a normal space and a nonbreaking space can display nearly identically while having different layout behavior. Check the actual character before deciding that the conversion succeeded.