Skip to content
UnitFormula

To convert a decimal number to another base, express it using that base's digits: binary uses 0–1, octal uses 0–7 and hexadecimal uses 0–9 then A–F. Each position is a power of the base — powers of 2 for binary, 8 for octal, 16 for hex. Enter a whole number and the calculator shows all three at once. For example, 255 is FF in hexadecimal, 377 in octal and 11111111 in binary.

Hex / Decimal / Binary Converter — number base converter

Base conversions for the decimal number 255.

Hexadecimal (base 16)FF
Binary (base 2)
11111111
Octal (base 8)
377

Quick examples

How it's calculated

  1. Expand the number as a sum of powers of two (its binary digits)255=128+64+32+16+8+4+2+1255 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1
    value
    = 255
    255
Hexadecimal (base 16)FF

How it works

Every counting system is positional: each digit's place is worth a power of the base. In everyday decimal (base 10) the places are 1, 10, 100, 1000 and so on. Change the base and the place values change with it:

  • Binary (base 2) uses digits 0 and 1; places are 1, 2, 4, 8, 16, …
  • Octal (base 8) uses digits 0–7; places are 1, 8, 64, 512, …
  • Hexadecimal (base 16) uses digits 0–9 then A, B, C, D, E, F for 10–15; places are 1, 16, 256, …

To convert, the calculator repeatedly divides the number by the target base and reads the remainders from last to first — equivalently, it finds how many of each place value the number contains. Binary makes this vivid: a number is just the sum of the powers of two that fit inside it.

Binary and hexadecimal are the languages of computers — one bit is a single binary digit, and one hex digit packs exactly four bits, which is why colours, memory addresses and byte values are so often written in hex.

Worked example

Take 255. In binary it is 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 — all eight bits set — so it is 11111111. Grouping those bits differently, it is 377 in octal and FF in hexadecimal (F is 15, and 15 × 16 + 15 = 255). That is why 255 is the largest value that fits in a single byte.

Frequently asked questions

How do I convert a decimal number to binary?

Divide the number by 2 repeatedly and record each remainder; reading the remainders from last to first gives the binary digits. Equivalently, add up the powers of two that fit inside it. For example, 255 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1, which is 11111111.

What is hexadecimal used for?

Hexadecimal (base 16) is compact: one hex digit represents four binary bits exactly, so a byte fits in two hex digits. Programmers use it for memory addresses, colour codes (like #FF0000 for red) and byte values because it is far shorter than binary yet maps to it cleanly.

What do the letters A to F mean in hex?

Base 16 needs sixteen digit symbols, but we only have ten (0–9). The letters A, B, C, D, E and F stand for the values 10, 11, 12, 13, 14 and 15. So FF means 15 × 16 + 15 = 255.

What is octal?

Octal is base 8, using digits 0 through 7. Each octal digit represents exactly three binary bits, which made it convenient on older computers. The number 255 is 377 in octal.

Why do computers use binary?

A binary digit has just two states — 0 or 1 — which maps directly onto the on/off state of an electronic switch. That reliability is why all digital hardware stores and processes data in binary, with other bases used as shorthand for humans.

What is the largest number in one byte?

A byte is eight binary digits, so it holds values from 0 to 2⁸ − 1 = 255. That is why 255 — FF in hex — appears so often as a maximum, for example the brightest value of a colour channel.

How we know this is right

Last reviewed
Aug 7, 2026
Precision
Rounded to 0 decimal places.
Read our methodology

Sources