Number Base Converter — Binary to Decimal, Hex & Octal
Convert a number between binary, decimal, hexadecimal, octal — or any base from 2 to 36 — without a network request and without losing precision on long values.
Binary 1010 equals decimal 10.
What this tool does
The same integer can be written in many bases, and different tools insist on different ones: a processor and a network mask speak binary, a memory address or a colour speaks hexadecimal, a Unix permission speaks octal, and a person speaks decimal. This converter reads a number in one base and rewrites it in another — the value never changes, only how it is written. It also accepts any base from 2 to 36, so unusual encodings such as base 32 and base 36, often used for short identifiers, are covered too.
Typical uses are checking a subnet mask or bit flag in binary, reading a hexadecimal address or CSS colour as a decimal, converting octal file permissions to a number you recognise, and turning a decimal constant into the binary or hex a program expects. Because the arithmetic uses arbitrary-precision integers, a 64-bit value or a long hexadecimal string converts exactly rather than being rounded at the limit of a floating-point number.
Method
Reading a number means multiplying an accumulator by the base and adding each digit in turn —
Horner's method — after stripping any digit separators and a matching 0b,
0o or 0x prefix. Writing it back divides the value by the target base
repeatedly and reads the remainders in reverse, mapping each remainder to a digit 0–9
or a–z. A character that is not a valid digit in the input base makes the conversion
fail with an empty result instead of producing a plausible but wrong number.
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
0 | 0 | 0 | 0 |
10 | 1010 | 12 | A |
26 | 11010 | 32 | 1A |
255 | 11111111 | 377 | FF |
256 | 100000000 | 400 | 100 |
1024 | 10000000000 | 2000 | 400 |
Frequently asked questions
How do I convert binary to decimal?
Choose Binary (base 2) as the input base and Decimal (base 10) as the output base, then type or paste the binary number. 1010 becomes 10, 11111111 becomes 255 and 100000000 becomes 256. Each 1 in the binary number counts its place value — powers of two from the right — and the decimal result is their sum.
How do I convert decimal to binary?
Set the input base to Decimal and the output base to Binary. The tool repeatedly divides the number by two and records the remainders, which is the standard method taught by hand: 13 → 1101, 100 → 1100100. Leading zeros are not shown because they do not change the value.
How do I convert hex to decimal, or decimal to hex?
Pick Hexadecimal (base 16) and Decimal and type either side. Hex uses the digits 0–9 and the letters A–F for 10–15, so FF is 255 and 1A is 26. The result is shown in upper case, the convention most datasheets, colour codes and memory dumps use.
Which bases are supported?
Every base from 2 to 36. Above base 10 the digits continue with the alphabet — a is 10, b is 11, and so on up to z which is 35 in base 36 — so base 36 behaves like a case-insensitive number-and-letter alphabet.
Does it handle large numbers?
Yes. The conversion uses arbitrary-precision integers, so a value far beyond the 2^53 limit of ordinary JavaScript numbers — a 64-bit identifier, a large hash fragment or a long binary string — converts exactly, with no rounding.
What input formats are accepted?
Digits with optional spaces, commas or underscores are all read the same way, so 1111 0000, 1111_0000 and 11110000 are equal. A leading 0b, 0o or 0x prefix is accepted when it matches the chosen base, and a leading minus sign is kept so negative values convert too.
Why did my input produce no result?
An empty output means the text is not a valid number in the base you selected — for example the digit 2 in a base-2 field, or the letter G in a base-16 field. Checking the input base is the usual fix.
Is my number sent anywhere?
No. The whole conversion runs in your browser with no network request, so even a private identifier or key you paste stays on your device.
Go deeper
Longer explanations of the problems this tool solves:
Sources
- Positional notation and radix conversion, as described in any discrete-mathematics or computer-architecture text; the method used here is Horner's rule.
- Unicode Digital Resources and the WHATWG Infra Standard for the
0–9,a–zdigit set used in bases above ten.
Everything runs in your browser — nothing you type is uploaded.