# HTML entity encoder

> Escape < > & and quotes for safe use in HTML, or decode entities such as &amp; and &#39; back to text. Optional numeric entities. Free.

Free tool by Orkosi. Page: https://orkosi.com/tools/html-entity-encoder

Show code on a web page without the browser running it, or read text that arrived full of &amp; and &#39;. Encode and decode in one place.

1. Paste the text or the HTML.
2. Choose Encode or Decode.
3. Press Convert and copy the result.

## Input

| Field | Type | Required | What it is |
| --- | --- | --- | --- |
| `text` | text | yes | Text or HTML. |
| `mode` | "encode" \| "decode" | no | Action. Default: "encode". |
| `non_ascii` | true \| false | no | Also encode accents and symbols. Default: false. |

## Example

Input:

```json
{
  "text": "<a href=\"/pricing\">Plans & pricing</a>",
  "mode": "encode"
}
```

Result:

```json
{
  "output": "&lt;a href=&quot;/pricing&quot;&gt;Plans &amp; pricing&lt;/a&gt;"
}
```

## Run it

It needs a free Orkosi account, nothing else. No credits are used.

- **A person**: open the page, enter an e-mail once, use the tool.
- **Claude or ChatGPT**: add the Orkosi connector `https://orkosi.com/api/v1/public/mcp` and sign in, or create the free account on the sign-in page. Then call `orkosi_run_free_tool` with `{ "tool": "html-entity-encoder", "input": { … } }`.
- **Any agent or program that can make an HTTP request**:

  1. Once, create the account: `POST https://orkosi.com/api/v1/public/signup` with `{ "name": "…", "email": "…", "terms_accepted": true }` and no key. Ask the person for the e-mail and their agreement to the terms first. The answer carries `data.api_key`, shown once.
  2. Run the tool:

```bash
curl -X POST https://orkosi.com/api/v1/public/tools/html-entity-encoder/run \
  -H "Authorization: Bearer $ORKOSI_API_KEY" -H "Content-Type: application/json" \
  -d '{"input":{"text":"<a href=\"/pricing\">Plans & pricing</a>","mode":"encode"}}'
```

The answer is `{ "data": { "tool": "…", "result": { … } } }`. A call without a key is answered 401 with the signup steps as data.

## Questions

**Which characters must be escaped in HTML?**

The ampersand, the less-than and greater-than signs and, inside attributes, the double and single quote. Those five are what this tool encodes.

**When should I encode non-ASCII characters?**

Only when the page or the email system is not UTF-8. Then accents and symbols are safer as numeric entities such as &#233;.

**Does decoding handle named entities?**

The common ones (amp, lt, gt, quot, apos, nbsp, copy, reg, trade, euro, pound, hellip, the dashes and angle quotes) and every numeric entity.

All free tools: https://orkosi.com/tools.md
