StringMash.com

Text to hex

Two digits a byte, which is the shortest way to write a byte exactly.

Conversion
7 characters
Updates as you type
Two digits a byte

Printable chart

Using the converter

Type on the left and two hex digits appear for each byte. Separator puts a space between bytes, a comma, or nothing at all, which is the form you want when pasting into code. Letters switches the digits A to F to upper case.

Swap the boxes to go the other way. The hex to text page starts in the decode direction if that's the job you arrived with.

Why two digits, always

A byte holds a number from 0 to 255. In hex that's 00 to FF, and it's never more or fewer than two digits. Four binary digits map onto exactly one hex digit, so eight map onto exactly two, with nothing left over.

Decimal has no such luck. A byte is one, two or three decimal digits depending on its value, so a run of decimal numbers needs separators to stay readable. Hex doesn't. 48692063616665 can be split into pairs by anyone, and that's why every hex dump, colour code and MAC address is written this way.

Accents and emoji cost more than one byte here too, on the same UTF-8 rules as binary. The é in the sample is c3 a9.

A-Z AND 0-9

Every character in two digits

A41
B42
C43
D44
E45
F46
G47
H48
I49
J4a
K4b
L4c
M4d
N4e
O4f
P50
Q51
R52
S53
T54
U55
V56
W57
X58
Y59
Z5a
030
131
232
333
434
535
636
737
838
939

Hexadecimal, and the word it replaced

Base 16 has had two names. Sexadecimal, built the ordinary way from the Latin for six and ten, turns up from the late 19th century, and Bendix still used it in manuals in the 1950s.

Hexadecimal is first recorded in 1952, in C. E. Fröberg's conversion tables printed in Lund, and it mixes the Greek hexa with the Latin decimal. Steven Schwartzman, in a 1994 dictionary of mathematical words, suggests the older word was avoided because of how it abbreviates.

The letters had competition too. The Bendix G-15 used u to z for the digits past 9, and the ILLIAC I used K, S, N, J, F and L. A to F settled in as the standard from 1966, after IBM published its Fortran IV manual for the System/360.

Related conversions

Text to binary shows the same bytes as bits, four times longer and easier to read one flag out of. Base64 packs three bytes into four characters, so it's denser than hex and unreadable by eye.

For the number behind a character rather than the bytes it's stored as, use the Unicode converter.

Questions

How do I convert text to hex?

Type it above. Each byte becomes two hexadecimal digits, and Separator decides what goes between them.

Why is hex used instead of decimal for bytes?

One hex digit is exactly four bits, so a byte is always exactly two digits. Decimal needs one, two or three digits depending on the value, which makes a run of bytes ambiguous without separators.

What is 48 65 6c 6c 6f?

It's "Hello". 48 is H, 65 is e, and 6c appears twice for the two Ls.

Does hex handle emoji?

Yes. An emoji is encoded as its UTF-8 bytes, usually four of them, so it comes out as eight hex digits.

Sources

Added . Last updated and reviewed . What's new