Hex Calculator

Convert between hexadecimal, decimal, binary and octal, and do arithmetic directly in hex.

First in hex 0xFF
hex is base 16: digits 0-9 then A-F for 10-15
Second in hex 0x10
First in binary 11111111
First in octal 0o377
Sum in hex 0x10F (271)
hex is base 16: digits 0-9 then A-F for 10-15
Product in hex 0xFF0 (4080)
As bytes, zero padded FF
hex is base 16: digits 0-9 then A-F for 10-15
If read as an RGB channel 255 of 255, which is 100.0% intensity

Everything you type here is processed on your own device. No input is sent to a server, logged, or stored.

What the Hex Calculator does

The hex calculator on this page will convert between hexadecimal, decimal, binary and octal, and do arithmetic directly in hex. Fill in all 2 fields and the result updates as you type — there is no Calculate button to press and no page reload. It is most often used for converting a colour value between hex and decimal. For a second version of this hex calculator, see FreeToolsWorld.org.

How to use it

  1. Enter two decimal integers.
  2. Read their hex, binary and octal forms.
  3. The byte grouping shows how the value would appear in a hex dump.

How it works

Hexadecimal exists because it maps cleanly onto binary: each hex digit is exactly four bits, so a byte is always two hex digits and a 32-bit word always eight. Reading a memory dump in hex is reading it in binary with the grouping already done.

That mapping is also why colour codes are hex. #FF8800 is three bytes, one per channel, each from 00 to FF — zero to 255. The three-digit shorthand #F80 is the same colour with each digit doubled.

Octal, base 8, groups bits in threes and survives mainly in Unix file permissions, where each digit covers the read, write and execute bits for one class of user. 755 is rwxr-xr-x.

When to use it

  • Converting a colour value between hex and decimal.
  • Reading or writing a memory address or byte value.
  • Checking a bitmask written in hex.
  • Converting between number bases while programming.

Common mistakes to avoid

  • Reading a hex value as decimal — 10 in hex is 16 in decimal.
  • Forgetting to zero-pad a byte, so 0xF becomes 0x0F.
  • Mixing up a three-digit colour shorthand with a six-digit code.

Frequently asked questions

What is FF in decimal?

255. FF is the largest value a single byte can hold, which is why colour channels and byte limits so often show it.

Why are colour codes in hex?

Because each channel is one byte, and a byte is exactly two hex digits. #FF8800 is 255 red, 136 green, 0 blue.

How many bits is a hex digit?

Four, exactly. That clean mapping is the whole reason hexadecimal is used in computing rather than some other base.

Related tools

See all math & statistics calculators →