Number Base Converter
Convert numbers between binary, octal, decimal, hexadecimal and any base.
What the Number Base Converter does
A number’s value is independent of the base you write it in — only the notation changes. Converting means repeatedly dividing by the target base and reading the remainders, which is why hexadecimal and binary line up so neatly at four bits per digit.
Formula
Value = Σ digitᵢ × baseⁱTo convert: divide by the target base, collect remainders, read them in reverse1 hex digit = 4 binary digits; 1 octal digit = 3 binary digitsBits needed = ⌊log₂(value)⌋ + 1
Inputs explained
| Input | Unit | Required | Notes |
|---|---|---|---|
| Value | text | Yes | Prefixes such as 0x, 0b and 0o are accepted and ignored. |
| Input base | one of 5 options | Yes | — |
| Custom input base | number | In some modes | Accepts 2 or more, up to 36. Shown Input base is Custom base. |
| Extra output base | number | Optional | Any base from 2 to 36, shown alongside the standard four. Accepts 2 or more, up to 36. |
| Bit width | one of 4 options | Yes | — |
How to use it
- Choose Input base and Bit width.
- Enter Value.
- Fill in the remaining inputs the form shows for your choice.
- Optionally add Extra output base.
- Select Calculate.
Worked example
Converting the decimal number 255.
- Value
- 255
- Input base
- Decimal
255 is 0xFF in hex, 0b11111111 in binary and 0o377 in octal — eight set bits, exactly one byte.
Frequently asked questions
Why is hexadecimal used so much in programming?
Because one hex digit is exactly four bits, so a byte is always two hex digits. Reading 0xFF is far easier than 0b11111111 and maps directly onto the underlying bits.
What is the largest value a byte can hold?
255 unsigned (0xFF), or −128 to 127 signed in two’s complement. Eight bits give 256 distinct values either way.