UTILITIES NEWBIE

Digital tools

HTML text escaper

Represent markup-sensitive characters as entity text instead of treating them as HTML tags.

Input

Import a local text file

0 UTF-16 code units

Optional local draft

Saving stores a plaintext draft in this browser on this device. Do not save secrets or use this on a shared device. Nothing is saved or loaded automatically. Reset does not delete a saved draft; use Delete local draft.

No draft has been loaded.

Output

How to use this tool

  1. Enter the text whose ampersands, angle brackets and quotes you want to encode.

  2. Select Escape HTML text. Copy the entity text only into a context where this specific encoding is appropriate.

Text encoding and escaping

Show markup as text. Full explanation follows.
<b> becomes &lt;b&gt;. Text explanation

The checked bold-element example encodes its angle brackets, ampersand and double quotes as HTML references. The output represents literal example text; it is not a parsed or sanitized document. Context-specific destination controls remain necessary.

Prepare literal markup characters for a text example

Decide whether the content should be text or markup

The HTML Escape page turns five markup-sensitive characters into HTML character references. Use it when an example should display literal angle brackets, ampersands or quotes rather than present those characters as part of markup source. The focused page supplies the HTML escaping operation, so you can enter a small text sample and inspect the result without choosing a database dialect or another programming language. It returns text that can be copied or downloaded. It does not render a website, edit a document, execute an example or certify a destination as safe.

A common use is preparing a tutorial that needs to show an element exactly as text. The decision comes before escaping: if the reader is meant to see the tag characters, they belong to the example; if the browser is meant to create an element, they belong to markup structure. Mixing these intentions often produces double escaping or accidental interpretation. Keep a raw copy of the example and label the escaped copy with its intended placement. That simple distinction makes it easier to review a template change without guessing whether the displayed result is deliberately literal.

This is a context-specific text converter, not an HTML sanitizer. It does not inspect a whole document and decide which tags, attributes, links or scripts should be allowed. It is also not a JavaScript, CSS or URL-context encoder. A value placed inside an event handler, style rule or address has additional syntax and trust requirements. Do not promote a successful result here into a claim that arbitrary user content can safely be inserted anywhere in a page. Use the destination framework's appropriate text APIs and security controls, and test the actual embedding context separately.

Follow the literal tutorial example

Checked synthetic input

<b>Tom & "Jo"</b>

Exact observed output

&lt;b&gt;Tom &amp; &quot;Jo&quot;&lt;/b&gt;

Enter the checked example containing a bold element, a name separated by an ampersand and a quoted second name. The output changes each angle bracket to its corresponding reference, the ampersand to &amp;, and each double quote to &quot;. The visible content of the original example is not interpreted as a tag tree. The example below shows the complete exact input and output so that you can compare opening and closing brackets, quote positions and spaces rather than simply noting that the result contains several ampersands.

The transformation treats the source as literal text in one pass. Entering an already escaped fragment such as &lt; produces &amp;lt;, because the source ampersand is itself data to encode. That is correct for an example that must display the literal reference spelling, but wrong if you intended to reuse an already encoded layer as markup. Do not run the operation repeatedly just because a result still contains punctuation. Decide which layer you are holding and which layer the destination expects. Preserve both versions while investigating a double-escaped display problem.

To reverse a supported HTML reference representation, use the encoding workspace's HTML unescape controls rather than pretending that the focused Escape button is a toggle. Unescaping decodes supported semicolon-terminated references once. In the checked case, &amp;lt; becomes &lt;, not an angle bracket in a single pass. Unknown references and unterminated names remain literal. The result can therefore contain a mixture of decoded characters and untouched spellings. Inspect it as text and do not assume that every ampersand denotes a recognized reference or that browser parsing would make identical recovery choices.

Know what the converter preserves and rejects

Escaping substitutes ampersand, less-than, greater-than, double quote and apostrophe. Ordinary text, spaces and other well-formed Unicode characters remain text. The HTML apostrophe output uses the numeric reference &#39;. The tool does not normalize every visually similar character, repair misspellings or change words into a preferred typographic style. A curly quotation mark and a straight quote are different source characters. If an example changes unexpectedly after copying from rich text, compare those actual characters before assuming the escaping logic has dropped or duplicated punctuation.

The processor rejects unpaired UTF-16 surrogates instead of treating them as valid standalone characters. HTML unescape also checks numeric references: malformed numeric syntax and invalid nonzero Unicode scalar values are rejected by this documented converter profile. These checks are not a full HTML document validation pass. They do not establish that the source has balanced elements, valid nesting or accessible content. Use a structure checker for that separate question, and remember that a structural check still does not replace a security review or an assessment of how the document is used.

Input is limited to 100,000 UTF-16 code units, generated output to 1,000,000 characters, and optional local text import to 100,000 bytes. Escaping can expand a short punctuation-heavy source substantially, because one character may become several characters in a reference. The byte limit for an imported UTF-8 file is separate from the source character limit. Splitting a production document to evade a limit is not a substitute for understanding its structure. For this teaching workflow, a compact representative fragment is usually more useful and much easier to verify than an entire page export.

Put the result into a reviewable workflow

When writing documentation, prepare one raw fixture and one escaped representation, then check the final rendered article in its real publishing environment. A correct converter result can still be double encoded by a template engine or passed through a different layer that changes the display. Document which system is responsible for each transformation. If the publishing system already treats example text as text, manually escaping it first may be unnecessary and confusing. The important outcome is a literal, accurate example in the destination, not the greatest possible number of character references.

For a template bug report, reduce the issue to a tiny synthetic sentence containing the characters that cause the discrepancy. Record whether the source was raw, escaped once or copied from a rendered page. Compare the exact output before and after the publishing step. The Copy control transfers generated text; Download provides a file handoff, and neither confirms what another application will do with it. Keep the original example so you can distinguish a conversion defect from a receiving editor that automatically escapes, decodes or replaces text during paste.

For localized help, retain meaningful letters and punctuation while checking the special characters independently. This page does not translate content, convert character sets or determine whether a sentence reads naturally in another language. Use the accompanying diagram and text explanation as a reminder of the transformation boundary, then verify your own fixture. Stop when the intended example is faithfully represented in the correct context. Do not remove material warnings or describe escaped text as universally harmless; the same characters can have different meanings when placed into different languages, attributes or application workflows.

Supporting reference: HTML character-reference context.

Related existing tool: encoding.

Worked examples

Input and settings

<p class="note">A & B</p>

Expected output

&lt;p class=&quot;note&quot;&gt;A &amp; B&lt;/p&gt;

The less-than, greater-than, quote and ampersand characters become HTML entity text. Encoding a string is different from sanitizing an HTML document or making an arbitrary URL safe.

Related tools

Inert HTML layout preview · HTML structural checker · SQL standard string literal escaper

Find a tool

Type a tool name, such as JSON or percentage.

Quick links

Browse by category

All tools