Number Base Converter
Convert numbers between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Supports arbitrary precision integers, prefix formats (0b, 0o, 0x), negative numbers, and two's complement representation.
Invalid input. Please enter a valid number for the selected base.
Oops! Sorry, the server failed to process your request, please try again later.
| Decimal |
|
|---|---|
| Hex (Lowercase) |
|
| Hex (Uppercase) |
|
| Hex (Grouped) |
|
| Hex (0x Prefix) |
|
| Binary |
|
| Binary (Grouped) |
|
| Octal |
|
| Base64 |
|
| Two's Complement |
|
| Two's Complement (Grouped) |
|
More about Number Bases
Number Systems
A number base (or radix) determines how many unique digits are used to represent numbers. In base N, each digit position represents a power of N.
| Base | Name | Digits | Common Use |
|---|---|---|---|
| 2 | Binary | 0, 1 | Digital circuits, data storage, bitwise operations |
| 8 | Octal | 0-7 | Unix file permissions, legacy systems |
| 10 | Decimal | 0-9 | Everyday counting, human-readable numbers |
| 16 | Hexadecimal | 0-9, A-F | Memory addresses, color codes, byte values |
Quick Conversion Reference
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 5 | 0101 | 5 | 5 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 255 | 11111111 | 377 | FF |
Common Prefixes
0bor0Bfor binary (e.g.,0b1010= 10)0oor0Ofor octal (e.g.,0o17= 15)0xor0Xfor hexadecimal (e.g.,0xFF= 255)
Two's Complement
Two's complement is the standard representation for signed integers in computing. To negate a number: invert all bits, then add 1. In an 8-bit system, values range from -128 (10000000) to 127 (01111111). The most significant bit indicates the sign: 0 for positive, 1 for negative.
Hex in Practice
- Colors:
#FF5733= RGB(255, 87, 51). Each pair of hex digits represents one byte (0-255). - Memory: Addresses like
0x7FFF5FBFF8A0are written in hex because each hex digit maps to exactly 4 binary digits. - File permissions:
chmod 755uses octal. 7 = rwx, 5 = r-x.