Number Base Converter

Convert integers exactly between binary, octal, decimal, hex and any base up to 36, with two's complement and base arithmetic.

Free · Instant · Private
Quick answer: In a positional system of base b, a digit string dk...d0 means sum of di × bi. So binary 1011 is 1×23 + 0×22 + 1×21 + 1×20 = 11 in decimal, and hexadecimal FF is 15×16 + 15 = 255. Every conversion below uses exact integer arithmetic, so even 100 digit values stay precise.
Decimal value
255

Equivalent representations

Binary is grouped in nibbles and hexadecimal in bytes so long values stay readable. Prefixed forms are ready to paste into code.

BaseNameValuePrefixed form

Positional expansion and repeated division

Read the digit column from the bottom row upwards to assemble the converted number.

DividendDivide by 2QuotientRemainderDigit
Bit pattern (hexadecimal)
0xFFFFFFFF
InterpretationValue
Result in decimal
265
BaseResult

Reference table: decimal 0 to 16

Four bit binary, octal, decimal and hexadecimal side by side. Generated live from the same conversion engine.

DecimalBinary (4 bit)OctalHexadecimal

Signed and unsigned ranges

The exact limits for each supported two's complement width.

BitsUnsigned rangeSigned range

What Is a Number Base?

A number base, also called a radix, is the number of distinct digit symbols a positional numeral system uses. Decimal is base 10 and uses the digits 0 through 9. Binary is base 2 and uses 0 and 1. Hexadecimal is base 16 and uses 0 through 9 plus A through F, where A means ten and F means fifteen. Above base 10, letters continue up to Z so that base 36 uses the full alphabet.

The base matters because each position in a numeral is worth the base raised to that position's index. The rightmost position has index zero. Changing the base changes the value of every position, which is why the digit string 10 means two in binary, eight in octal, ten in decimal and sixteen in hexadecimal.

How Base Conversion Works

For a digit string with digits dk down to d0 in base b:

value = dk × bk + ... + d1 × b1 + d0 × b0

That single formula converts any base into decimal. To go the other way, use repeated division:

  1. Divide the decimal value by the target base and write down the remainder.
  2. Replace the value with the integer quotient and divide again.
  3. Repeat until the quotient is zero.
  4. Read the remainders from last to first; they are the digits from most significant to least significant.
  5. Map remainders 10 to 35 to the letters A to Z when the base exceeds 10.

Positional Notation and Digit Values

A digit's numeric value must always be smaller than the base. In base 8 the digit 8 is meaningless; in base 2 the digit 2 is meaningless. This tool checks every character and reports exactly which digit is invalid instead of silently producing a wrong answer. Common prefixes are recognised: 0b for binary, 0o for octal and 0x for hexadecimal. A prefix that disagrees with the selected base is rejected.

Repeated Division, Step by Step

StepDividendQuotientRemainderBinary digit
113611
26300
33111
41011

Reading the remainders upwards gives 1101, so decimal 13 is binary 1101. The converter shows this table for any input you type, using the same algorithm.

Fractions, Precision and Very Large Integers

This tool handles integers only. A fractional part would require a radix point and a repeating expansion in many bases, which is a separate problem. Precision is nevertheless important: a JavaScript Number is a double precision value that stops representing every integer exactly above 253. That is why this page uses arbitrary precision integers for all scaling, so a hexadecimal value with 40 digits converts exactly rather than being rounded to the nearest representable double.

Worked Examples

InputInput baseExpansionDecimalHexadecimal
101121×8 + 0×4 + 1×2 + 1×111B
37783×64 + 7×8 + 7×1255FF
255102×100 + 5×10 + 5×1255FF
0xFF1615×16 + 15×1255FF
-0b10102-(1×8 + 0×4 + 1×2 + 0×1)-10-A
Z3635×13523
1000000000000000021×2166553610000
DEADBEEF1613×167 + ... + 15×1603735928559DEADBEEF

The first four rows all describe the same quantity, 255, written in four different bases. That is the central idea: a number is independent of the notation used to write it.

Two's Complement Explained

Computers store signed integers in a fixed number of bits. Two's complement is the dominant representation. For a width of w bits, let M = 2w. A signed value v in the range -M/2 to M/2 - 1 is stored as the unsigned pattern v mod M. Values whose top bit is 1 are interpreted as negative by subtracting M.

For 8 bits, M = 256. The value −1 becomes 256 − 1 = 255, whose bit pattern is 11111111, written as 0xFF. The value −128 becomes 128, or 0x80. Adding two's complement numbers with ordinary binary addition gives the correct signed result as long as it stays inside the range, which is why the same hardware adder works for both signed and unsigned arithmetic.

Sign Extension and Range Checks

WidthUnsigned rangeSigned rangePattern for -1
8 bit0 to 255-128 to 1270xFF
16 bit0 to 65535-32768 to 327670xFFFF
32 bit0 to 4294967295-2147483648 to 21474836470xFFFFFFFF
64 bit0 to 18446744073709551615-9223372036854775808 to 92233720368547758070xFFFFFFFFFFFFFFFF

When a value is widened, sign extension copies the top bit into the new high positions. The converter reports whether your input fits the unsigned range, the signed range, or neither, and shows the exact bit pattern for the width you chose.

Number Base Reference Table

DecimalBinaryOctalHexadecimal
0000000
1000111
2001022
7011177
81000108
10101012A
15111117F
16100002010

Notice the useful boundaries: 7 is the largest 3 bit value, 15 is the largest 4 bit value and one hex digit, and 255 is the largest unsigned byte. These are the numbers that appear constantly in colour codes, network masks and file formats.

Common Mistakes

  • Forgetting which base the input is in. The string 10 is two, eight, ten or sixteen depending on the base.
  • Using a digit equal to or larger than the base. The digit 8 cannot appear in octal, and G cannot appear in hexadecimal.
  • Dropping leading zeros in a fixed width field. In a bit pattern, 00001010 is not the same field as 1010 when the width matters.
  • Confusing a signed and an unsigned reading. The 8 bit pattern 11111111 is 255 unsigned and -1 signed.
  • Converting each hex digit separately for multi digit numbers. Only positional weighting gives the right total.
  • Trusting floating point with long values. Above 253, a JavaScript Number silently rounds integers.
  • Assuming a base conversion also changes the number. It changes only the written representation.

Practical Uses and Long-Tail Searches

Students and developers look for "binary to decimal converter", "decimal to binary with steps", "hex to decimal converter", "octal to binary chart", "two's complement calculator 16 bit", "convert 0xFFFFFFFF to decimal", "base 36 converter" and "signed vs unsigned 8 bit range". Typical jobs include reading colour codes, decoding bit flags, checking subnet masks, interpreting compiler warnings and studying computer architecture. For bit level network work, the IPv4 CIDR Subnet Calculator applies the same binary ideas to addresses, and the Math Calculator is handy when a conversion is only one step in a longer calculation.

Historical numeral systems are a different topic: Roman numerals are not positional and have no base in this sense. If that is what you need, the Roman numeral converter linked below handles it separately.

Authoritative References

  • IEEE Std 754-2019 defines the binary64 double precision format used by JavaScript Number, whose contiguous exactly representable integers stop at 253.
  • ECMA-262 specifies the BigInt type used here for arbitrary precision integer arithmetic.
  • Donald E. Knuth, The Art of Computer Programming, Volume 2, Section 4.1 gives the classical treatment of positional number systems and radix conversion algorithms.

These sources are named as plain text for attribution; no outbound links are placed in this tool.

Key Takeaways

  • Each digit position in base b is worth b raised to that position's index, counting from zero on the right.
  • To convert from decimal, divide repeatedly by the target base and read the remainders backwards.
  • One hexadecimal digit equals exactly four binary digits, so two hex digits describe one byte.
  • Two's complement stores a signed value v as v modulo 2 to the power of the bit width.
  • Use arbitrary precision integers whenever a value may exceed 253.

Last updated: December 4, 2026 · All calculations run locally in your browser. No values are stored or transmitted.

Number Base Converter FAQ

What is a number base?

A number base, or radix, is the count of distinct digit symbols a positional numeral system uses, and it determines the multiplier between adjacent digit positions.

How do I convert binary to decimal?

Multiply each binary digit by 2 raised to its position from the right, starting at zero, and add the products; for example, 1011 is 1x8 + 0x4 + 1x2 + 1x1 = 11.

How do I convert decimal to binary?

Divide the decimal number repeatedly by 2, record each remainder, and read the remainders from last to first.

Why do programmers use hexadecimal?

One hexadecimal digit represents exactly four binary digits, so a byte is written as two compact hex digits instead of eight bits.

What is two's complement?

Two's complement represents a negative integer in a fixed bit width by taking the bit pattern of the value modulo two to the power of that width.

What is the range of a signed 8 bit integer?

A signed 8 bit two's complement integer ranges from -128 to 127, while an unsigned 8 bit integer ranges from 0 to 255.

Can this converter handle numbers larger than 64 bits?

Yes. It uses arbitrary precision integers, so conversions remain exact for any length of input.

Is my input sent to a server?

No. Every conversion is computed locally in your browser and nothing is uploaded or stored.