ForHosting KIT · Text & AI

Convert text to hexadecimal

«Hello, hex!» becomes 48656c6c6f2c2068657821: 11 bytes, each shown as two hexadecimal digits. Paste hex back and the text returns, while odd lengths and invalid bytes are refused instead of guessed. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Text
Hello, hex!
You get
Hex
48656c6c6f2c2068657821
Bytes
11
Calculation mode
Encode
Encoding
utf-8

Text and hexadecimal are two useful views of the same UTF-8 data. Decode mode deliberately rejects odd-length strings, non-hexadecimal characters, and byte sequences that are not valid UTF-8, preventing silent padding or replacement characters from changing the original information.

Convert readable text into hexadecimal bytes

Choose encode mode and enter the exact text you want to inspect or transport. Encode is the default, so a request containing only the text field is enough for the common text-to-hexadecimal operation. The converter serializes the JavaScript string as UTF-8 and writes every resulting byte as exactly two lowercase hexadecimal digits.

For example, basic Latin letters usually occupy one byte each, while accented characters, non-Latin scripts, and emoji use multiple bytes. That distinction matters because hexadecimal represents encoded bytes, not visual characters or abstract Unicode code points. The response includes the original text, the continuous hex string, the number of UTF-8 bytes, the resolved mode, and the encoding name.

Preserve whitespace in the input when it matters: spaces, tabs, and line breaks are data and therefore receive their own byte values. An empty string is also valid and produces an empty hexadecimal string with a byte count of zero. Since the algorithm uses no network, clock, random value, or external state, repeated requests with the same string always return precisely the same result.

Decode hexadecimal safely back into UTF-8 text

Choose decode mode when the input field contains hexadecimal bytes rather than readable text. Supply one continuous string made only from digits zero through nine and letters a through f; uppercase letters are accepted and normalized to lowercase in the response. The converter first checks that the string has an even number of characters because every byte requires a complete pair of hexadecimal digits.

A value with three, five, or any other odd number of digits is rejected rather than guessed, padded, or truncated. It then rejects punctuation, prefixes, whitespace, separators, and letters outside the hexadecimal alphabet. These strict rules make malformed data visible and keep automated pipelines predictable.

Once parsing succeeds, the bytes are decoded with a fatal UTF-8 decoder. A byte sequence that cannot represent valid UTF-8 text returns an input error instead of inserting replacement symbols that could conceal corruption. The empty hexadecimal string is a valid zero-byte value and decodes to empty text.

If your source includes spaces or a leading zero-x marker, remove those decorations before submitting it.

Use deterministic conversion in tools and automated workflows

Use the browser form for quick debugging, teaching, copy-and-paste conversions, or checking what a visible string looks like at byte level. A practical test suite should include a plain ASCII example, a multibyte Unicode example, a successful reverse conversion, and at least one odd-length or illegal-character failure. Assert the byte count as well as the text and hex fields, because character length and UTF-8 byte length are not interchangeable.

Treat the conversion as an encoding view, not encryption: hexadecimal does not hide content, authenticate a sender, compress a message, or protect secrets. Anyone can reverse it. It is best used wherever exact byte visibility and reversible formatting are needed, including protocol documentation, database migrations, log analysis, interoperability checks, educational demonstrations, and troubleshooting discrepancies between systems.

Unicode education

Show why visible characters can occupy different numbers of UTF-8 bytes and compare ASCII, accented text, scripts, and emoji.

Does encode mode use UTF-8?

Yes. Text is serialized as UTF-8 bytes, and each byte becomes two lowercase hexadecimal digits.

Can I include spaces, dashes, or a 0x prefix?

No. Decode mode intentionally accepts only a continuous hexadecimal digit string, which keeps validation and canonical output unambiguous.

What happens when the bytes are not valid UTF-8?

The conversion returns an invalid input error instead of silently inserting Unicode replacement characters.

Is hexadecimal a secure way to hide text?

No. Hexadecimal is a reversible representation of bytes, not encryption, hashing, access control, or secret protection.

Why must the hexadecimal have an even number of digits?

Because every byte needs a complete pair of digits. A value with three, five or any other odd number of digits is rejected rather than padded, truncated or guessed, so a damaged string never turns quietly into the wrong text.

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.

POSThttps://api.kit.forhosting.com/text/text-to-hex

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.

curl -X POST https://api.kit.forhosting.com/text/text-to-hex \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello"}'
{
  "text": "Hello"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "text.text_to_hex",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_tokens20000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Decode hexadecimal safely back into UTF-8 text

A successful response contains the recovered text, normalized hexadecimal, byte count, decode mode, and UTF-8 encoding label. This capability interprets bytes as text; arbitrary binary payloads that are not UTF-8 should remain in a binary-safe format instead.

Use deterministic conversion in tools and automated workflows

Use the API when a script, SDK, continuous-integration job, documentation generator, or support workflow needs the identical operation repeatedly. Each successful item costs $0.002; malformed reverse inputs fail with invalid_input so callers can distinguish data problems from service failures. For very large files, use a streaming or file-oriented tool rather than placing the entire payload into a single text item.

Protocol and API debugging

Inspect the exact UTF-8 bytes behind request fields, response samples, or short protocol messages, then reverse known bytes into readable text.

Stable software fixtures

Create canonical lowercase hexadecimal values for unit tests, documentation examples, migration checks, and cross-language interoperability assertions.

Why must decoded hexadecimal have an even length?

One byte requires two hexadecimal digits. An odd count leaves an incomplete byte, so the request is rejected.

Read the full KIT documentation →