Number Base Converter
Translate integers across bases without losing precision.
- Local by default
- No signup
- AI is opt-in
Integers only. A 0x, 0b or 0o prefix overrides the selected base.
Converted
Byte equivalents
Bases are read as unsigned magnitudes; two's complement and fixed-width overflow are not applied. Binary and hex grouping only changes the display, never the value.
Paste an integer and see it in binary, octal, decimal and hexadecimal at the same time. The conversion uses BigInt, so 64-bit identifiers, hashes and counters stay exact instead of drifting past the 2^53 limit of JavaScript numbers.
Positional notation, briefly
Every base writes the same idea with a different set of digits. In base b, a digit in position n (counting from zero on the right) is worth digit × bn. Decimal 255 is 2×100 + 5×10 + 5×1. In binary the same value is 11111111, because it is 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1. Hex ff is 15×16 + 15×1.
255 (base 10) = 11111111 (base 2) = 377 (base 8) = ff (base 16)The value never changes when you change the base; only the spelling does. That is why a converter is a pure formatting operation, not an arithmetic one.
Why binary, octal and hex travel together
Binary maps directly to hardware: a wire is on or off. But long binary strings are hard to read, and 23 = 8 and 24 = 16 mean that one octal digit covers three bits and one hex digit covers four. Grouping is exact, with no rounding, so octal and hex are compact spellings of the same bits.
- Hexadecimal: colors (
#5b9dff), byte dumps, MAC addresses, hashes and Unicode code points. - Octal: Unix file permissions (
755), where each digit packs read/write/execute bits. - Binary: bit masks, flags and teaching how a value is stored.
When digit grouping is enabled, binary is split into groups of four and hex into groups of four as well. The separator is cosmetic: the numeric value is identical with or without it.
BigInt and the 2^53 ceiling
JavaScript stores ordinary numbers as IEEE 754 doubles. Integers above 253 − 1 (9,007,199,254,740,991) can no longer be represented exactly, so a 64-bit ID may silently change when parsed with Number. This tool converts digits with BigInt, which has no such ceiling, so a 20-digit value converts digit for digit.
BigInt is arbitrary precision, not unlimited memory. Extremely long inputs still cost time and space, but there is no hidden 64-bit wrap and no rounding.
If you move a value out of this page into JavaScript, keep it as a string or a BigInt. Passing it through JSON.parse turns it back into a double and reintroduces the precision loss.
Decimal bytes and binary bytes
Storage vendors count in powers of ten and operating systems often count in powers of two, which is why a “500 GB” drive shows as roughly 465 GiB. The byte equivalents under the result use both conventions on purpose.
- 1 KB = 1,000 bytes; 1 MB = 1,000,000 bytes. Used on packaging and in networking.
- 1 KiB = 1,024 bytes; 1 MiB = 1,048,576 bytes. Used by memory sizes and many file managers.
- The mismatch is about 2.4% at kilo, 4.9% at mega and 7.4% at giga, which is enough to make a disk look smaller than advertised.
Prefixes, leading zeros and signs
A 0x, 0b or 0o prefix overrides the selected input base, matching the literals used in most programming languages. Spaces and underscores inside the number are ignored, so 1111_0000 reads as 11110000. A leading zero is just a zero in base ten here; it does not switch the value to octal.
Negative input is read as a sign plus a magnitude, not as two's complement. -1 in an 8-bit two's complement field is 11111111, but this tool shows -1 and -1 in binary because it has no fixed width. If you need wraparound behaviour, decide the width first and apply the complement yourself.
Where this shows up in real work
- Reading a hex color and checking which bits are set in the alpha channel.
- Decoding file permission masks such as
0644and0755. - Inspecting protocol flags, where each bit has a name and a decimal mask.
- Comparing a hash prefix or an identifier without losing digits.
- Teaching why
0.1 + 0.2is not exact: the same floating-point representation is behind both problems.
Frequently asked questions
Can it convert numbers larger than 2^53?
Yes. Conversion uses BigInt, so values beyond the safe integer range keep every digit. Only the byte equivalents are approximate for enormous inputs, and they are marked with a ≈ sign.
Does a leading zero mean octal?
Not here. A leading zero is an ordinary zero in base ten. Modern JavaScript also removed implicit octal literals, so use 0o755 when you mean octal. This tool accepts the explicit 0o prefix.
Why is hexadecimal output lowercase?
Lowercase is the common convention for hashes, colors and most programming languages. If you need uppercase, a text case converter or an editor transform gives you the same digits.
Can it convert fractions or scientific notation?
No. Only integers are accepted. Values such as 1.5 or 1e9 are rejected, because fractional digits have different place values in each base and would change the meaning of the result.
How are negative numbers handled?
The sign is kept separate from the magnitude. Results read as -ff rather than as an eight-bit two's complement value. Fixed-width representations depend on the width you choose and are not assumed here.
Is anything sent to a server?
No. Parsing and conversion run in your browser with BigInt arithmetic. The page makes no network request while you type.