Hex converter

Type a hex value and see it as decimal, binary and text at once. Then pick the tool for the job: numbers, bytes, files or colors.

Hex in, three answers out
Decimal72 105
Binary01001000 01101001
TextHi

Runs in your browser. Nothing you type is uploaded.

Hex numbers

For a hex value that stands for an amount, an address or a register.

Hex to decimalBase 16 to base 10, with stepsFF → 255
Decimal to hexBase 10 to base 16, with steps255 → FF
Hex calculatorHex math with the working shown2B9 + FA7 → 1260
Hex to octalBase 16 to base 8FF → 377
Hex to binaryEach hex digit as 4 bitsFF → 11111111

Hex bytes, text and files

For hex that is a run of bytes rather than one number.

Hex to textDecode hex bytes as ASCII or UTF-848 65 6C 6C 6F → Hello
Text to hexText and ASCII to hex bytesHi → 48 69
Hex editorView and edit file bytesphoto.png → 89 50 4E 47 0D 0A 1A 0A
Hex dumpText or files to a hex dumpHi → 00000000 48 69 |Hi|

Hex colors

For six hex digits after a # sign.

RGB to hexColor values to hex codes255, 136, 0 → #FF8800
Hex to RGBHex color codes to RGB values#FF8800 → 255, 136, 0
Color codesNamed colors with hex, RGB and shadesTeal → #008080

What is this hex value?

The way a value is written usually tells you what it is.

How it is writtenExampleUsually means
0x before the digits0x1A3A number in C, Python or JavaScript, here 419
# and six digits#FF8800A web color: red FF, green 88, blue 00
h after the digits1A3hA number in assembly language
$ before the digits$FFA number in Pascal or 6502 assembly, here 255
&H before the digits&HFFA number in Visual Basic, here 255
\x before each pair\x48\x69Bytes inside a string in C, Python or a shell, here "Hi"
Pairs separated by spaces48 65 6C 6C 6FA run of bytes, often text, here "Hello"

Files start with the same bytes

Most file types begin with a fixed signature, sometimes called a magic number. Open a file in the hex editor and the first row shows it, whatever the file is named.

File typeFirst bytesAs text
PNG image89 50 4E 47 0D 0A 1A 0A.PNG....
JPEG imageFF D8 FFNot readable as text
GIF image47 49 46 38GIF8
PDF document25 50 44 46 2D%PDF-
ZIP archive, also .docx, .xlsx and .jar50 4B 03 04PK..
Windows program (.exe, .dll)4D 5AMZ
Linux program (ELF)7F 45 4C 46.ELF

Number, bytes or a color?

Hex is base 16. The digits run from 0 to 9 and then A to F, so one hex digit covers exactly four bits and two digits cover one byte. That is why debuggers, file viewers and color codes all show bytes in hex: FF is quicker to read than 11111111.

The same digits can mean different things, so look at how the value is written. 1A3 on its own is most likely a number, 419. 48 69 with a space between pairs is usually bytes, and those read as text. Six digits after a # are a color: red, green and blue, one byte each.

Frequently asked questions

What is a hex code?

A hex code is a color written as six hex digits after a #: two for red, two for green and two for blue. Each pair runs from 00, none of that color, to FF, full strength. #FFFFFF is white, #000000 is black and #FF0000 is pure red. In programming, "hex code" can also mean any value written in hexadecimal.

How do you convert hex to decimal by hand?

Multiply each digit by 16 raised to its position, counting from 0 on the right, and add the results. A stands for 10, B for 11 and so on up to F for 15. For 1A3 that is 1 × 256 + 10 × 16 + 3 × 1 = 419.

What does 0x mean before a number?

It marks the digits as hex in C, Python, JavaScript and many other languages. Without it, 10 could be ten or sixteen. With it, 0x10 is always sixteen.

Scroll to Top