Number Base Converter
Understand Number Base Converter
Converts a whole number between binary, octal, decimal, and hexadecimal.
How it works
Every base is positional: each digit is multiplied by the base raised to its position. 0xFF is (15 × 16) + 15 = 255, and 11111111 in binary is the same value with eight ones. Hexadecimal earns its place in programming because the mapping to binary is exact — one hex digit is always four bits — so 0xFF is 11111111 and 0x0F is 00001111 with no arithmetic required. Octal groups bits in threes instead, which is why Unix permissions are octal: each digit is exactly one rwx triplet.
When to use it
- Reading a bitmask or a set of flag constants out of firmware, a protocol spec, or a driver header
- Translating a hex color channel to decimal, or an octal file mode to its binary bit pattern
- Checking a memory address, register value, or byte offset shown in one base against documentation written in another
- Working through a computer-science exercise where the conversion itself is the point
Watch out for
- Prefixes are rejected. Enter `FF`, not `0xFF`, and `1010`, not `0b1010` — the `x` and `b` are not valid digits in their base and the input is refused.
- Precision runs out above 2^53 − 1 (9,007,199,254,740,991). A 64-bit identifier, a Snowflake ID, or a full-width hash pasted as one number will convert to a rounded value that looks plausible and is wrong. Split it or use BigInt.
- Negatives are shown in sign-magnitude form, so −5 becomes −101 in binary. That is not two's complement, which is what a CPU register actually holds (11111011 in eight bits).
- Whole numbers only. There is no fractional part, so 0.5 cannot be shown as 0.1 in binary here.
Frequently Asked Questions
How do I convert hex to decimal?
Each hex digit represents a power of 16. 0xFF = (15×16) + 15 = 255. 0x1A = (1×16) + 10 = 26. The tool converts instantly — type in any base and all four representations update simultaneously.
Why is hexadecimal used in programming?
Hexadecimal maps cleanly to binary: one hex digit = exactly 4 bits. So 0xFF = 11111111 (all bits set), 0x0F = 00001111 (low 4 bits). This makes hex compact and readable for memory addresses, color values (#RRGGBB), bitmasks, and byte-level protocol fields.
What does octal represent in Unix permissions?
chmod 755 uses octal: 7 = 111 (rwx), 5 = 101 (r-x). The three octal digits map to owner, group, and other permissions. chmod 644 = 110 100 100 = rw-r--r--. Each of the three permission bits (read=4, write=2, execute=1) is a power of 2.
How to Use Number Base Converter
- Paste or type your input in the input area above.
- The tool processes your input automatically or click Run.
- Copy or download the result using the action buttons.
- Use Ctrl+Enter to run quickly from the keyboard.