# Hex encoder and decoder

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

- Endpoint: `POST https://setget.net/v1/tools/hex` with JSON `{"input": {...}}`
- MCP: `run_tool` with `slug` = `hex`
- Page: https://setget.net/tools/hex

## Inputs

- `text` (required, string): The text to encode, or the hex to decode.
- `action` (optional, string, one of `encode`, `decode`, default `"encode"`): Encode text to hex, or decode hex to text.
- `uppercase` (optional, boolean, default `false`): Write the hex digits A-F in upper case when encoding.
- `separator` (optional, string, one of `none`, `space`, `colon`, default `"none"`): What to put between bytes when encoding.

## Example 1

```json
{"input":{"text":"Hello"}}
```

Result:

```json
{"text":"48656c6c6f","bytes":5}
```

## Example 2: Upper case with colons

```json
{"input":{"text":"Hi!","uppercase":true,"separator":"colon"}}
```

Result:

```json
{"text":"48:69:21","bytes":3}
```

## Example 3: Decoding ignores prefixes and separators

```json
{"input":{"text":"0x48 0x65 6c:6c:6f","action":"decode"}}
```

Result:

```json
{"text":"Hello","bytes":5}
```

**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.
