TestBench.tools

ASCII to Hex Converter

Convert ASCII text to hex byte strings.

2 bytes

Hex bytes
48 69

Need the other direction? Hex to ASCII Converter →

This tool converts ASCII text to hex bytes instantly: type Hi and you get 48 69. The output is spaced, uppercase and two digits per byte — the format serial terminals, protocol testers and CRC calculators expect. A live byte counter shows exactly how many bytes you are about to send.

How it works

Every ASCII character has a numeric code: H is 72 decimal, 0x48 hex; i is 105, i.e. 0x69. The converter writes each character's code as a two-digit hex byte in order. Control characters typed into the box (like a newline, 0x0A) convert the same way, which is useful when a device protocol requires an explicit CR/LF terminator.

Worked example

ascii: Hi
hex  : 48 69

ascii: OK⏎  (with newline)
hex  : 4F 4B 0A

Parameters

ParameterValueNotes
InputASCII textone byte per character
Outputspaced uppercase hexe.g. 48 69
Control charsconverted literallynewline → 0A
Non-ASCIIlow byte keptsingle-byte workflow

Python implementation

Python
# ASCII text -> spaced uppercase hex bytes
def ascii_to_hex(text: str) -> str:
    return " ".join(f"{ord(c) & 0xFF:02X}" for c in text)

assert ascii_to_hex("Hi") == "48 69"

FAQ

What format is the hex output?

Uppercase two-digit bytes separated by spaces, e.g. Hi becomes 48 69. That format pastes cleanly into most serial terminals, protocol test tools and this site's other calculators.

How are line breaks and special characters handled?

Every character in the input becomes exactly one byte of its ASCII code — a line break in the text box becomes 0A (LF). The byte counter under the input shows how many bytes the output contains.

What about non-ASCII characters like é or 한?

The converter keeps only the low byte of each character code, since it targets single-byte ASCII workflows. For multi-byte UTF-8 encoding use a dedicated Unicode tool.

Can I convert hex back to text?

Yes — the companion Hex to ASCII page, linked below the tool, does the reverse.

Is my text uploaded?

No. Conversion runs entirely in your browser.

Related tools