Number Base Converter
Type an integer in binary, octal, decimal or hexadecimal and see it in all four bases at once. Large values are converted exactly with BigInt, and single bytes get a bit-by-bit view.
⚙ Convert a number
📚 Quick reference table
| Decimal | Binary | Octal | Hex |
|---|
What this converter is for
Programmers, electronics students and network engineers switch between number bases all the time. A memory address or colour value is written in hexadecimal, a Unix permission such as chmod 755 is octal, and a status register or flag byte is easiest to reason about in binary. This page takes one integer written in binary (base 2), octal (base 8), decimal (base 10) or hexadecimal (base 16) and shows the same value in all four bases side by side. Values from 0 to 255 also get an 8-bit diagram with the weight of every bit, and values from 256 to 65,535 are shown as four 4-bit groups.
How to use it
- Choose the base your number is written in from the drop-down next to the input box. Decimal is selected by default.
- Type or paste the number. The results update on every keystroke, so there is no Convert button to press. The
/key jumps to the input from anywhere on the page. - Read the four result tiles. The tile for the base you entered is highlighted, and the small grey label (
0b,0o,0x) shows the prefix most programming languages use for that base. The prefix is not part of the copied value. - Click a result to copy it. Spaces are removed when copying, so grouped binary is copied as one continuous string of digits.
- Try the sample buttons (FF, 11111111, 255, 777, DEADBEEF), or filter the quick reference table to look up common values such as the powers of two or the 8- and 16-bit limits.
How the conversion works
The page reads your input one character at a time and builds the value with JavaScript BigInt (value = value × base + digit). Because BigInt is an exact integer type, there is no floating-point rounding and no 253 ceiling, so a 40-digit hexadecimal string converts without losing a single bit. Each output is then produced by dividing repeatedly by the target base and collecting the remainders as digits. Hex letters are accepted in upper or lower case and are always printed in upper case. Everything runs in your browser; the numbers you type are not sent to a server.
Binary output longer than four digits is padded with leading zeros to a multiple of four and split into nibbles. Every hexadecimal digit corresponds to exactly one nibble and every octal digit to three bits, which is why these two bases serve as shorthand for binary.
| Base | Digits | Prefix | Where you meet it |
|---|---|---|---|
| 2 (binary) | 0–1 | 0b | Bit masks, flags, hardware registers |
| 8 (octal) | 0–7 | 0o | Unix file permissions such as 644 or 755 |
| 10 (decimal) | 0–9 | none | Everyday counting and arithmetic |
| 16 (hex) | 0–9, A–F | 0x | Colour codes (#FF5733), memory and MAC addresses, byte dumps |
Worked example: decimal 2024 becomes binary 0111 1110 1000, octal 3750 and hexadecimal 7E8. Reading the hex back: 7 × 256 + 14 × 16 + 8 = 2024.
Input rules and limits
- Only whole numbers are accepted. A decimal point, a leading plus sign, or scientific notation such as 1e6 typed in Decimal mode makes the input invalid; the box turns red and the tiles show “Invalid input”.
- A prefix is removed only when it matches the selected base. With Decimal selected,
0x1Fis rejected; with Hexadecimal selected,0B1is read as the hex number B1 (177), because B is a valid hex digit. - Digits that do not exist in the chosen base, such as 8 in octal or 2 in binary, are rejected rather than silently skipped.
Frequently asked questions
How are negative numbers shown?
With a minus sign in every base, for example −255 becomes −FF and −11111111. This is not two's complement. To see the bit pattern a computer stores for a negative value in n bits, add 2n first: the 8-bit pattern of −1 is 256 − 1 = 255, which is FF or 11111111.
Is there a maximum size?
There is no fixed limit because BigInt grows as needed. In practice inputs with many thousands of digits may make typing feel slow, since each keystroke repeats the full conversion.
Why does the binary result start with extra zeros?
They are padding to complete the leftmost 4-bit group, so 511 appears as 0001 1111 1111. The value is unchanged, and the padded zeros are included when you copy the binary result.
Can it convert fractions or floating-point numbers?
No. The converter works with integers only. Converting fractional values between bases, or showing the IEEE 754 bit pattern of a float, needs a different tool.
Is anything I type stored or uploaded?
No. The conversion is pure client-side JavaScript, nothing is written to your browser storage, and the input is not transmitted.