Hex encoder and decoder

Convert text to hexadecimal bytes and back, with optional upper case and separators.

Input

The text to encode, or the hex to decode.
Encode text to hex, or decode hex to text.
Write the hex digits A-F in upper case when encoding.
What to put between bytes when encoding.

Result

Fill in the input and press Run.

Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.

Use it from code or an agent

curl -s https://setget.net/v1/tools/hex \
  -H 'Content-Type: application/json' \
  -d '{"input":{"text":"Hello"}}'
import json, urllib.request

body = {'input': {'text': 'Hello'}}
request = urllib.request.Request("https://setget.net/v1/tools/hex", json.dumps(body).encode(),
                                 {"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/hex", {
  method: "POST",
  headers: {"Content-Type": "application/json"},
  body: JSON.stringify({"input":{"text":"Hello"}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
  "slug": "hex",
  "input": {
    "text": "Hello"
  }
}
{
  "input": {
    "text": "Hello"
  }
}

Endpoint: POST /v1/tools/hex. Over MCP: run_tool with slug: "hex". Machine-readable: input schema, Markdown. Connect an agent.

Inputs

NameTypeRequiredWhat it does
text string yes The text to encode, or the hex to decode.
action string no Encode text to hex, or decode hex to text. One of: encode, decode. Default: "encode".
uppercase boolean no Write the hex digits A-F in upper case when encoding. Default: false.
separator string no What to put between bytes when encoding. One of: none, space, colon. Default: "none".

Examples

Input
{
  "text": "Hello"
}
Result
{
  "text": "48656c6c6f",
  "bytes": 5
}

Upper case with colons

Input
{
  "text": "Hi!",
  "uppercase": true,
  "separator": "colon"
}
Result
{
  "text": "48:69:21",
  "bytes": 3
}

Decoding ignores prefixes and separators

Input
{
  "text": "0x48 0x65 6c:6c:6f",
  "action": "decode"
}
Result
{
  "text": "Hello",
  "bytes": 5
}

Questions

Which separators can I decode?
Spaces, line breaks, colons, commas, hyphens and "0x" prefixes are all ignored when decoding.
Why does decoding fail with "not UTF-8"?
The bytes are binary data, not text. Hex is already the clearest way to show them.