How Positional Number Systems Work
Every number system you'll meet in programming - binary, octal, decimal, hexadecimal - is positional: each digit's value depends on both the digit itself and its position, which represents a power of the base. In decimal, the number present as "present" is present = dn×10n + ... + d1×101 + d0×100. Binary works identically, just with powers of 2 instead of powers of 10; hexadecimal uses powers of 16.
Computers use binary at the hardware level because a transistor only needs to represent two reliable states (on/off). Hexadecimal exists purely for humans - each hex digit maps to exactly 4 bits, so a long binary string becomes a short, easy-to-read hex string without losing any precision in the translation.
Converting By Hand
To convert from any base to decimal, multiply each digit by its place value (a power of the base) and add the results. For example, binary 1011 is 1×8 + 0×4 + 1×2 + 1×1 = 11 in decimal.
To convert from decimal to any other base, repeatedly divide by the target base and record the remainders, then read them bottom-to-top. For example, converting decimal 11 to binary: 11 ÷ 2 = 5 remainder 1, 5 ÷ 2 = 2 remainder 1, 2 ÷ 2 = 1 remainder 0, 1 ÷ 2 = 0 remainder 1 - reading the remainders bottom-to-top gives 1011. This tool performs exactly that divide-and-remainder process internally using BigInt arithmetic, so it works correctly no matter how large the number is.
Nibbles, Bytes & Why Grouping Bits Helps
| Unit | Bits | Possible values | Typical use |
|---|---|---|---|
| Bit | 1 | 0 or 1 | A single binary digit |
| Nibble | 4 | 0-15 (one hex digit) | Reading binary as hex at a glance |
| Byte | 8 | 0-255 | Memory addressing, file sizes, a single character in many encodings |
A long, unbroken string of 0s and 1s is hard to scan. Grouping it into nibbles or bytes - the way this tool's bit breakdown does - lets you quickly spot patterns and cross-check against the hexadecimal value, since each 4-bit group is literally one hex digit.
Common Use Cases
#1a2b3c are hex-encoded RGB bytes - convert each pair of digits to decimal to get the 0-255 red/green/blue values.Frequently Asked Questions
Each Unix permission triplet - read, write, execute - is exactly 3 bits, and one octal digit (0-7) represents exactly 3 bits, so a single octal digit maps perfectly onto one permission group (owner, group, others). Hexadecimal's 4-bit digits don't divide evenly into groups of 3, which is why chmod and similar Unix tools have stuck with octal even though hex is more common elsewhere.
Modern word sizes - 8, 16, 32, and 64 bits - are all multiples of 4, so they divide evenly into hex digits with nothing left over; a byte is always exactly two hex digits. Those same word sizes don't divide evenly into groups of 3 bits, so octal digits don't line up as cleanly with today's byte-oriented hardware, even though octal was common on some historic minicomputers with 6-bit or 9-bit words.
Two's complement is how most hardware represents negative integers internally: it flips every bit of the positive value and adds 1, so the same circuitry that does addition can also do subtraction. That representation requires picking a fixed bit width (8-bit, 32-bit, and so on) up front, since the result depends on how many leading 1 bits are implied. This tool instead shows a negative value as an ordinary minus sign in front of the magnitude (signed magnitude) in every base, since it has no fixed bit width to work from.
Yes for decimal input, with an optional leading minus sign. Negative values are shown in every base using a leading minus sign (signed magnitude) rather than two's complement, since two's complement also requires choosing a fixed bit width, which this tool does not ask for.
A nibble is 4 bits - exactly enough to represent one hexadecimal digit (0-F). A byte is 8 bits, or two nibbles, and is the standard unit computers use for memory addressing and file sizes.
Each base only allows its own digit set: binary allows just 0 and 1, octal allows 0-7, decimal allows 0-9 (with an optional leading minus), and hexadecimal allows 0-9 and A-F. Any other character - including stray letters, symbols, or spaces - triggers a specific error naming the first invalid character and its position.