Binary, Hex & Decimal Converter

Convert numbers between binary, octal, decimal and hexadecimal, including very large values.

  • Reviewed November 2026
  • Formula and worked example below
  • Free, no sign-up, runs in your browser
Enter your numbers to see the result.

How number bases work

In base 10 each position is worth ten times the one to its right. In binary (base 2) each position is worth twice as much, in hexadecimal (base 16) sixteen times. Hexadecimal uses the letters A–F for the values 10–15.

Binary 11111111 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255, which is FF in hexadecimal and 377 in octal.

Why programmers use hex

Each hex digit represents exactly four binary digits (bits), so a byte is always two hex digits. Web colors such as #1F6F5C are three bytes for red, green and blue. Memory addresses, file signatures and network hardware (MAC) addresses are also written in hex.

Converting decimal to binary by hand

Divide by 2 repeatedly and write down the remainders, then read them from bottom to top. 13 ÷ 2 = 6 r1, 6 ÷ 2 = 3 r0, 3 ÷ 2 = 1 r1, 1 ÷ 2 = 0 r1, so 13 is 1101 in binary.

This converter uses arbitrary-precision arithmetic, so it handles numbers far larger than a typical calculator. Below each result it shows the working: the division remainders for decimal input, or each digit times its place value for binary, octal and hex input.

Negative numbers and two's complement

Computers store negative integers in two's complement: write the positive value in binary, invert every bit and add 1. Enter a negative decimal number to see it in the smallest standard width (8, 16, 32 or 64 bits). In the other direction, a binary or hex value that fills a whole 8-, 16-, 32- or 64-bit word and starts with a 1 bit is also shown as a signed integer.

−1 in 8 bits: 1 = 0000 0001, inverted 1111 1110, plus 1 = 1111 1111 (FF). −129 does not fit in 8 bits (the range is −128 to 127), so it is shown in 16 bits: FF7F. Read the other way, hex FF as a signed byte is −1.

Bytes, ASCII and base 36

The result also lists how many bits and bytes the number needs, the ASCII character for values from 32 to 126 (65 is "A", 97 is "a") and base 36, which uses the digits 0–9 and letters A–Z and is common in short IDs and URL shorteners. The largest unsigned 64-bit value, 2⁶⁴ − 1 = 18,446,744,073,709,551,615, is FF FF FF FF FF FF FF FF in hex.

Frequently asked questions

How do I convert binary to decimal?

Multiply each bit by its place value (1, 2, 4, 8, …) from the right and add the results.

What is 255 in binary?

11111111, the largest value that fits in one byte.

What does 0x mean?

The prefix 0x marks a hexadecimal number in programming, for example 0xFF = 255.

Add this calculator to your website

Copy this code into your page:

Last reviewed November 2026.