Convert numbers between decimal, binary, hexadecimal, and octal instantly.
Valid characters: 0123456789
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 4 | 0100 | 4 | 4 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 0001 0000 | 20 | 10 |
| 32 | 0010 0000 | 40 | 20 |
| 64 | 0100 0000 | 100 | 40 |
| 128 | 1000 0000 | 200 | 80 |
| 255 | 1111 1111 | 377 | FF |
| 256 | 0001 0000 0000 | 400 | 100 |
| 512 | 0010 0000 0000 | 1000 | 200 |
| 1024 | 0100 0000 0000 | 2000 | 400 |
A number base (or radix) defines how many unique digits a number system uses. The decimal system (base 10) that we use daily has digits 0–9. Binary (base 2) has only 0 and 1. Octal (base 8) uses 0–7. Hexadecimal (base 16) uses 0–9 plus A–F to represent values 10–15.
These number systems aren't just academic — they're the foundation of modern computing. Every piece of data a computer stores or processes is ultimately binary. Hexadecimal provides a human-readable shorthand for binary: since 16 = 2⁴, each hex digit perfectly represents exactly 4 binary bits, making it far more compact than writing out long strings of 0s and 1s.
Understanding base conversion is useful for web developers (CSS color codes), security professionals (reading hex-encoded data), computer science students, and anyone working with low-level systems or networking.
Binary (Base 2)
Digits: 0, 1
Used for: Computer hardware, logic gates, bitwise operations, networking masks
255 = 1111 1111
Octal (Base 8)
Digits: 0–7
Used for: Unix/Linux file permissions (chmod), legacy systems
255 = 377
Decimal (Base 10)
Digits: 0–9
Used for: Human everyday math, currency, most user-facing displays
255 = 255
Hexadecimal (Base 16)
Digits: 0–9, A–F
Used for: Memory addresses, color codes, cryptographic hashes, bytecode
255 = FF
Convert 42 to binary:
42 ÷ 2 = 21 R0
21 ÷ 2 = 10 R1
10 ÷ 2 = 5 R0
5 ÷ 2 = 2 R1
2 ÷ 2 = 1 R0
1 ÷ 2 = 0 R1
Read remainders bottom-up → 101010
Convert 1010 1100 to decimal:
1×2⁷ + 0×2⁶ + 1×2⁵ + 0×2⁴ + 1×2³ + 1×2² + 0×2¹ + 0×2⁰
= 128 + 0 + 32 + 0 + 8 + 4 + 0 + 0 = 172
Each hex digit = exactly 4 binary bits:
A = 1010, B = 1011, C = 1100, D = 1101
E = 1110, F = 1111, 5 = 0101, 7 = 0111
So: 0x5F = 0101 1111 = decimal 95
And: 0xFF = 1111 1111 = decimal 255
Web Colors (CSS)
#FF6600 is hex for RGB(255, 102, 0). FF=255 red, 66=102 green, 00=0 blue. Hex is compact and human-readable for 24-bit color values.
IPv4 Networking
Subnet masks like 255.255.255.0 are expressed as decimals but are really binary masks. 255 = 1111 1111 — all 8 bits set.
Unix Permissions
chmod 755 = 111 101 101 in binary. Owner: rwx (7), Group: r-x (5), Other: r-x (5). Octal is a natural fit for 3-bit permission groups.
Memory Addresses
RAM addresses are shown in hex: 0x00400000. A 64-bit address space goes from 0x0 to 0xFFFFFFFFFFFFFFFF.
ASCII / Unicode
The letter 'A' is 0x41 (hex) = 65 (decimal) = 0100 0001 (binary). Character encoding tables always use hex for readability.
Cryptographic Hashes
SHA-256 hashes are 256-bit binary outputs displayed as 64 hex characters. e.g. a3f8...d2c1 is 256 bits in 64 hex digits.
Multiply each bit by 2 raised to its position (right to left, starting at 0) and sum. For 1011: 8+0+2+1 = 11.
Repeatedly divide by 2, record remainders, read bottom-up. 13 → R1, R0, R1, R1 → 1101.
Base 16, using 0–9 and A–F. Each hex digit = 4 binary bits. Used for memory addresses, color codes, and bytecode because it compactly represents binary data.
Multiply each digit by 16 raised to its position. For 2F: (2×16) + (15×1) = 32+15 = 47. A=10, B=11, C=12, D=13, E=14, F=15.
Digits 0–7. Each octal digit = 3 binary bits. Used in Unix file permissions (chmod 755). Decimal 8 = octal 10.
The 0x prefix indicates hexadecimal in programming. 0xFF = 255 decimal. 0b prefix = binary; 0o prefix = octal.
Bits = floor(log₂(n)) + 1. So 255 needs 8 bits. A byte (8 bits) holds 0–255.
Nibble = 4 bits (one hex digit, 0–15). Byte = 8 bits (two hex digits, 0–255). Word = 16/32/64 bits depending on CPU architecture.
Percentage Calculator
Calculate any percentage, ratio, or change between numbers.
GPA Calculator
Calculate your grade point average using letter grades and credit hours.
Date Calculator
Find days between dates and add or subtract days from a date.
Age Calculator
Calculate your exact age in years, months, and days.
Calculation method: Converts via JavaScript's parseInt(value, fromBase) and Number.toString(toBase). Supports non-negative integers. Input is validated to only accept characters valid for the selected base. Hex output is uppercase. Binary output is grouped in nibbles (4 bits) for readability. Last updated: September 2026. Maintained by The Free Calculator Site.
Share your thoughts
Help us improve The Free Calculator Site