About Number Bases
A number base (or radix) tells you how many distinct digits a counting system uses before it rolls over to a new column. The familiar decimal system uses base 10 — ten digits, 0 through 9. Computers work with base 2 because electronic switches have two states. Hexadecimal (base 16) and octal (base 8) are compact shorthand for binary: one hex digit represents exactly 4 binary bits, and one octal digit represents 3.
The four bases
| Base | Name | Digits | Prefix | Used by |
|---|---|---|---|---|
| 2 | Binary | 0 1 | 0b | Logic gates, CPU instructions |
| 8 | Octal | 0–7 | 0o | Unix file permissions, legacy systems |
| 10 | Decimal | 0–9 | (none) | Everyday arithmetic |
| 16 | Hexadecimal | 0–9 A–F | 0x | Memory addresses, colours, byte dumps |
Small numbers across bases
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 4 | 100 | 4 | 4 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
| 1024 | 10000000000 | 2000 | 400 |
| 65535 | 1111111111111111 | 177777 | FFFF |
Common integer ranges
| Type | Bits | Unsigned range | Signed range |
|---|---|---|---|
| Byte | 8 | 0 to 255 | −128 to 127 |
| Short | 16 | 0 to 65,535 | −32,768 to 32,767 |
| Int | 32 | 0 to 4,294,967,295 | −2,147,483,648 to 2,147,483,647 |
| Long | 64 | 0 to 18,446,744,073,709,551,615 | −9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
Why hexadecimal
Hex is popular because 4 binary bits map cleanly to 1 hex digit. A byte (8 bits) is exactly 2 hex digits — 11111111 becomes FF. That makes hex far more readable than raw binary while remaining trivially convertible. When you see #FF5733 as a colour, that is three bytes (red, green, blue) written as 6 hex digits. When you see a memory address like 0x7FFF5FBFF8C0, that is 8 bytes in hex — a 64-bit pointer.
Why octal still matters
Octal remains common in Unix because file permissions are traditionally written as three or four octal digits. chmod 755 means: owner gets read+write+execute (4+2+1=7), group gets read+execute (4+1=5), others get read+execute (4+1=5). Each octal digit encodes 3 permission bits (rwx). It is a compact and still-relevant notation.
Two's complement for negative numbers
Computers represent negative integers using two's complement: the most significant bit (MSB) is the sign bit, 0 for positive and 1 for negative. To negate a number, invert all bits and add 1. This tool shows the magnitude of negative numbers in the standard way (with a minus sign), not as two's complement bit patterns — that is a different, though related, representation worth knowing about.
Common use cases
Colour Codes
Convert RGB decimal values to hex for CSS colours.
Embedded Systems
Read register values, bitmasks and hardware addresses.
Unix Permissions
Convert chmod octal permissions to readable bits.
Debugging
Interpret hex dumps and memory addresses.
Networking
Convert IP addresses, MAC addresses and subnets.
Education
Learn how binary, octal and hex relate to each other.
Privacy and accuracy
This binary/hex/decimal converter runs entirely in your browser using the native BigInt type. Numbers are handled with full arbitrary precision, so a 100-digit decimal converts to hex without any loss. Nothing is uploaded, stored or logged.