Decimal HTML entities converter
Hi becomes Hi: every character, including spaces, accents and emoji, is written as its decimal code point between &# and a semicolon. Paste ABC to get ABC back. Hex and named forms are refused. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Text
- Hi
- Calculation mode
- Encode
- Result
- Hi
- Encoding
- html_entities_decimal
- Input length
- 2
- Output length
- 11
This decimal HTML entities converter rewrites ordinary text as a pure stream of decimal numeric character references such as A for the letter A, and it reverses the same form when you paste entities back into plain Unicode. Encoding walks every Unicode scalar value—including spaces, punctuation, accented letters, and emoji—so the output is a contiguous sequence of &#digits; tokens with no separators. Decoding accepts only well-formed decimal references that end with a semicolon, rejects hex &#x…; forms and named entities such as &, and fails loudly on incomplete or empty numeric stubs so broken markup never silently survives into production. The path is fully deterministic: the same text and mode always produce the same result, with no network calls, no random salts, and no date-dependent shortcuts. Small checks include encoding Hi into Hi and decoding ABC back into ABC.
What decimal HTML numeric character references are and what this tool returns
A decimal HTML numeric character reference is a textual escape of the form ampersand, hash, one or more decimal digits, and a terminating semicolon. The digits are the Unicode code point of the character you intend: sixty-five is Latin capital A, thirty-two is space, and one million two hundred eighty-five one two is a common emoji scalar. Unlike named entities such as or €, decimal NCRs need no shared name table and work for any valid scalar value a browser or XML parser accepts.
Unlike hexadecimal forms that start with hash-x, decimal forms stay simple to type, to grep, and to generate from codePointAt loops in any language. This page encodes by iterating Unicode scalar values so surrogate pairs become a single &#N; rather than two wrong UTF-16 unit escapes, then concatenates the references without spaces so the reverse decode is exact. Incomplete stubs such as &#; or A without a semicolon also fail.
Bare ampersands that do not form a complete entity are left unchanged so draft text is not destroyed, but every complete non-decimal entity is reported.
Where decimal HTML entities fit in markup, testing, and interoperability
Developers meet decimal numeric character references when a CMS export stores every glyph as &#N;, when an email or XML gateway insists on ASCII-only transport of Unicode titles, and when a test suite needs opaque text that still round-trips through HTML parsers without relying on named-entity tables that differ between HTML4 and HTML5. Frontend teams decode entity-heavy copy pulled from legacy databases so UI components render true letters and emoji instead of literal ampersand-hash sequences.
Quality engineers generate deterministic encode and decode pairs for contract tests so a middleware that claims NCR support cannot silently switch to hex or named forms between releases. Educators use the same tool when teaching the difference between decimal references, hexadecimal references, and named entities that modern HTML parsers accept.
What you can do with it
ASCII-safe Unicode transport
Encode titles and labels as pure &#N; streams so Unicode survives ASCII-only HTML or XML hops without named-entity tables.
Legacy CMS NCR cleanup
Decode decimal numeric character references from exported markup or database fields back into plain Unicode for modern UIs.
FAQ
What does the decimal HTML entities converter cost?
It is free in your browser on this page.
Which characters are encoded?
Encode mode rewrites every Unicode scalar value as &#N;. Spaces, punctuation, letters, and emoji are all converted—not only special HTML characters.
Is the result deterministic?
Yes. The same text and mode always produce the same result with no network, randomness, or date-dependent behavior.
Does it decode hex or named entities?
No. It only reads decimal references such as A. A complete hexadecimal reference, which starts with &#x, or a named one such as & is rejected, and the message names the reference that caused it.
How are emoji encoded?
As a single reference carrying the full code point, not as two halves. The tool walks whole Unicode characters, so an emoji becomes one &#N; token and decodes back exactly.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/enc/html-entities-decimal \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Hi"}'const res = await fetch("https://api.kit.forhosting.com/enc/html-entities-decimal", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "Hi"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/enc/html-entities-decimal",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "Hi"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/enc/html-entities-decimal", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"Hi"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"Hi"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/enc/html-entities-decimal", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"text": "Hi"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "enc.html_entities_decimal",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
What decimal HTML numeric character references are and what this tool returns
The JSON response always includes result for the transformed string, mode echoing encode or decode, encoding fixed to html_entities_decimal, input_length and output_length for size assertions, a codepoints array of integers for programmatic consumers, and either entities_encoded or entities_decoded so tests can confirm how many scalars were rewritten. Decode does not invent named-entity tables and does not accept hex numeric forms: a complete &name; or &#xH; sequence raises invalid_input with a message that names the bad reference.
How text and mode are read and how results stay reproducible
Encode walks the string with for-of iteration over scalar values, reads each code point, and emits &#codePoint; with no trailing separator, so empty input yields an empty result and a single character yields a single entity. The preferred payload field is text, with aliases input, value, s, and html so forms, query strings, and SDK clients can reuse the same contract without renaming columns. Mode defaults to encode and accepts decode explicitly; aliases op, direction, and action map to the same switch for scripts that already use those names. Decode scans left to right: when it sees an ampersand followed by hash and decimal digits ending in a semicolon it emits the matching character; when it sees hash-x hex forms, named entities, empty digit runs, or missing semicolons after digits it raises invalid_input instead of guessing. The length ceiling of one hundred thousand characters keeps Worker memory predictable while still covering templates, sample documents, and most paste buffers. Pair the free browser run on this page with the priced API when you need the identical mapping inside an automated pipeline without re-implementing numeric-entity parsing yourself. Invalid inputs return invalid_input and are not charged, which keeps validation cheap while successful transforms remain a fixed item price at $0.002.
Where decimal HTML entities fit in markup, testing, and interoperability
Backend services encode dynamic labels before embedding them in constrained HTML snippets or JSON that later becomes markup, guaranteeing that every character—including quotes and angle brackets—survives as data rather than structure. On this page the work runs entirely in your browser; through the API each successful lookup costs $0.002, failed validation is not charged, and nothing is stored after the response returns. That split—free interactive exploration and a priced, identical API—matches the rest of the KIT tier-A catalog and lets you move from a classroom demo to an automated pipeline without changing the encoded result. Pair it with the general HTML entities helper when you only need special-character escaping, and with other encoding endpoints when you are building a small lab of free, deterministic text tools.
Integration use cases
Deterministic CI fixtures
Generate reproducible encode and decode pairs for unit tests, golden files, and contract checks across services.
Technical questions
What modes are supported?
mode=encode (default) turns text into decimal numeric character references. mode=decode turns well-formed &#N; sequences back into characters.
What happens if a reference is malformed?
Decode fails with invalid_input for hex forms (A), named entities (&), incomplete stubs (&#;), missing semicolons, and out-of-range code points.