Number Base Converter
Convert between binary, octal, decimal, hex, and any base 2–36 — instantly in your browser, nothing sent to any server
Input
Base reference chart ▸
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
What Is a Number Base Converter?
A number base converter — also called a radix converter or numeral system converter — translates a number written in one base (radix) into an equivalent representation in another base. Every base uses a fixed set of symbols (digits) to represent values, and the position of each digit determines its weight as a power of the base.
This tool converts instantly between the four most common numeral systems used in computing:
- Binary (base 2): uses digits
0and1— the fundamental language of digital hardware - Octal (base 8): uses digits
0–7— historically used in Unix file permissions - Decimal (base 10): uses digits
0–9— the everyday human number system - Hexadecimal (base 16): uses
0–9andA–F— compact notation for binary data
You can also convert to and from any custom base between 2 and 36, using digits 0–9 and letters A–Z.
Why Do Computers Use Binary?
Digital computers are built from transistors that operate in two states: on (1) and off (0). This makes binary the natural language of hardware. Every piece of data a computer processes — text, images, audio, instructions — is ultimately stored and transmitted as sequences of 0s and 1s (bits).
Working directly in binary is tedious for humans because numbers grow long quickly. The decimal number 255 requires 8 binary digits (11111111). This is where hexadecimal becomes invaluable.
Binary and Hexadecimal: A Natural Pair
Each hex digit corresponds exactly to 4 binary bits (a nibble):
| Decimal | Binary | Hex |
|---|---|---|
| 0 | 0000 | 0 |
| 1 | 0001 | 1 |
| 4 | 0100 | 4 |
| 8 | 1000 | 8 |
| 10 | 1010 | A |
| 15 | 1111 | F |
This means you can convert binary to hex (and vice versa) by grouping bits into sets of 4:
Binary: 1010 1111 0011 1100
Hex: A F 3 C
And back:
Hex: 0x2B4F
Binary: 0010 1011 0100 1111
This grouping makes hex ideal for reading memory addresses, color codes, bitmasks, and byte values.
How to Convert Binary to Decimal
To convert a binary number to decimal, multiply each bit by its positional power of 2 and sum the results. The rightmost bit has position 0.
Example: Convert 1011 (binary) to decimal
| Bit | Position | Power | Value |
|---|---|---|---|
| 1 | 3 | 2³=8 | 8 |
| 0 | 2 | 2²=4 | 0 |
| 1 | 1 | 2¹=2 | 2 |
| 1 | 0 | 2⁰=1 | 1 |
8 + 0 + 2 + 1 = 11 (decimal)
The “Show conversion steps” section in this tool walks through this calculation automatically for any number you enter.
How to Convert Decimal to Binary
The standard method is repeated division by 2:
- Divide the number by 2 — record the remainder
- Divide the quotient by 2 — record the remainder
- Repeat until the quotient is 0
- Read the remainders from bottom to top
Example: Convert 42 (decimal) to binary
| Division | Quotient | Remainder |
|---|---|---|
| 42 ÷ 2 | 21 | 0 |
| 21 ÷ 2 | 10 | 1 |
| 10 ÷ 2 | 5 | 0 |
| 5 ÷ 2 | 2 | 1 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
Reading from bottom to top: 101010 — so 42 (decimal) = 101010 (binary).
How to Convert Decimal to Hexadecimal
Use the same repeated-division method, but divide by 16 instead of 2. Remainders 10–15 are represented as A–F.
Example: Convert 255 (decimal) to hex
| Division | Quotient | Remainder | Digit |
|---|---|---|---|
| 255 ÷ 16 | 15 | 15 | F |
| 15 ÷ 16 | 0 | 15 | F |
Reading from bottom to top: FF — so 255 (decimal) = FF (hexadecimal).
This is why 255 is the maximum value of a single byte: 0xFF = 11111111 in binary = 8 bits all set to 1.
Octal and Unix File Permissions
Octal (base 8) is less common today but still appears in Unix/Linux file permissions. Each octal digit represents 3 binary bits:
| Octal | Binary | Permissions |
|---|---|---|
| 7 | 111 | rwx (read, write, execute) |
| 6 | 110 | rw- (read, write) |
| 5 | 101 | r-x (read, execute) |
| 4 | 100 | r— (read only) |
| 0 | 000 | --- (none) |
The common chmod 755 command sets:
- Owner:
7(rwx) - Group:
5(r-x) - Others:
5(r-x)
In binary: 111 101 101 = permission bits for a typical executable file.
Common Developer Use Cases
Color Codes (#RRGGBB)
CSS hex colors are 3 bytes (RGB) in hexadecimal. #1A2B3C means:
- Red:
1Ahex = 26 decimal - Green:
2Bhex = 43 decimal - Blue:
3Chex = 60 decimal
IPv4 Addresses
IP addresses are 32-bit numbers, sometimes expressed in hex. 192.168.1.1 = C0A80101 in hex.
Bitmasks and Flags
Programmers use binary and hex to work with bit flags. Checking if bit 3 is set: value & 0x08 (hex) or value & 0b00001000 (binary).
Memory Addresses
Debuggers and disassemblers display memory addresses in hexadecimal (e.g., 0x7FFE4000). Understanding hex lets you read and interpret these values.
ASCII and Unicode Code Points
Character code points are often expressed in hex. The letter A is U+0041 (hex 41 = decimal 65). The snowman emoji ☃ is U+2603 (hex 2603 = decimal 9731).
BigInt: No Overflow, No Precision Loss
Standard JavaScript numbers use 64-bit IEEE 754 floating-point arithmetic, which can only represent integers exactly up to 2^53 (about 9 quadrillion). Numbers larger than this lose precision silently — a serious problem for cryptographic keys, large hash values, and database IDs.
This converter uses JavaScript BigInt, which handles integers of arbitrary size with exact arithmetic. Whether you’re converting a 4-digit decimal or a 512-bit hexadecimal number, you get the correct result every time.
Grouped Display for Readability
Long binary strings are hard to read. This tool automatically groups binary output into sets of 4 bits (nibbles), mirroring how engineers annotate binary data:
Without grouping: 10101100101011001010
With grouping: 1010 1100 1010 1100 1010
Hexadecimal output is grouped in pairs of 2 digits (bytes):
Without grouping: DEADBEEF
With grouping: DE AD BE EF
This matches the format used in hex editors, memory dumps, and protocol specifications.
Base Notation Reference
Different bases are often written with prefixes to avoid ambiguity:
| Base | Prefix | Example |
|---|---|---|
| Binary (2) | 0b | 0b1010 |
| Octal (8) | 0o or 0 | 0o12 |
| Decimal (10) | none | 10 |
| Hexadecimal (16) | 0x | 0xA |
Frequently Asked Questions
What is the largest number this tool can convert? There is no practical limit. The converter uses JavaScript BigInt, so it can handle numbers with thousands of digits accurately.
Does the tool support negative numbers?
Yes. Prefix your input with - (e.g., -255) and the tool converts it correctly, preserving the sign in all outputs.
What happens with leading zeros?
Leading zeros are stripped from the input (e.g., 0042 is treated as 42). This follows standard mathematical convention.
Can I convert text/strings to binary? This tool converts numeric values between bases. To convert text characters to binary, use the separate encoding tools — each character can be converted to its Unicode code point (a decimal number) and then to binary.
What is base 36?
Base 36 uses digits 0–9 and letters A–Z (26 + 10 = 36 symbols). It’s the largest base this tool supports and is used in URL shorteners, identifier generation, and compact numeric encodings where case-insensitivity is desired.