CCalclabhub

How To Convert Number Bases Calculator

A number base is just a choice of how many digits to count to before starting a new column. Converting between bases means regrouping the same quantity into different columns, and the arithmetic is the same place-value arithmetic you already use in decimal.

Case does not matter for hexadecimal. A leading minus sign is allowed, and spaces or underscores are ignored.

Binary

11111111

Decimal
255
Octal
377
Hexadecimal
FF
Bit length
8

The formula this calculator uses

value = sum of (digit x base^position)

base
How many digits the system uses
digit
The symbol in each column, from 0 to base minus 1
position
Column index, counting from zero at the right

How to check the result by hand

  1. 1

    Write the digits in place

    Line the digits up and number the columns from zero at the right, so the rightmost digit is the base to the power zero.

  2. 2

    Multiply each digit by its place value

    In binary the place values are 1, 2, 4, 8, 16 and so on. In hex they are 1, 16, 256, 4096.

  3. 3

    Add the products for decimal

    The sum is the value in decimal. For 11111111 that is 128 plus 64 plus 32 plus 16 plus 8 plus 4 plus 2 plus 1, which is 255.

  4. 4

    Group bits for octal or hex

    From the right, split the binary digits into groups of three for octal or four for hex, then read each group as a single digit.

  5. 5

    Check the bit length

    The number of binary digits tells you how many bits the value needs. Eight bits hold up to 255, sixteen up to 65535, and thirty-two up to about 4.3 billion.

For worked examples, common mistakes and the limits of this formula, read the full How To Convert Number Bases page.