๐ข Number Base Converter
Convert numbers between different number systems: binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Free online number base converter with real-time conversion.
Uses digits 0-9
Uses digits 0-9, A-F
Uses digits 0-9. Prefix none is optional.
Common Number Conversions
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 16 | 10000 | 20 | 10 |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
| 1024 | 10000000000 | 2000 | 400 |
What is a Number Base?
A number base (also called radix) is the number of unique digits, including zero, used to represent numbers in a positional numeral system. The most common number base is 10 (decimal), which we use in everyday life. However, computers and programming languages often use different bases like binary (base 2), octal (base 8), and hexadecimal (base 16).
Each position in a number represents a power of the base. For example, in decimal (base 10), the number 123 represents (1 ร 10ยฒ) + (2 ร 10ยน) + (3 ร 10โฐ) = 100 + 20 + 3 = 123.
Number Systems Explained
Binary (Base 2)
Uses only two digits: 0 and 1. This is the fundamental number system used by computers.
Example: 1010 in binary = 10 in decimal
Prefix: 0b or 0B
Octal (Base 8)
Uses digits 0 through 7. Less common but still used in some Unix file permissions.
Example: 755 in octal = 493 in decimal
Prefix: 0o or 0O
Decimal (Base 10)
Uses digits 0 through 9. This is the standard number system we use in daily life.
Example: 42 in decimal = 42
Prefix: None
Hexadecimal (Base 16)
Uses digits 0-9 and letters A-F (or a-f). Very common in programming and web development for colors and memory addresses.
Example: FF in hexadecimal = 255 in decimal
Prefix: 0x or 0X
Common Use Cases
Conversion Examples
Decimal to Binary
To convert 42 from decimal to binary:
42 รท 2 = 21 remainder 0
21 รท 2 = 10 remainder 1
10 รท 2 = 5 remainder 0
5 รท 2 = 2 remainder 1
2 รท 2 = 1 remainder 0
1 รท 2 = 0 remainder 1
Reading remainders from bottom to top: 101010
So 42 (decimal) = 101010 (binary)Binary to Hexadecimal
To convert 101010 from binary to hexadecimal:
Group binary digits into groups of 4 from right:
101010 โ 0010 1010
Convert each group:
0010 = 2 (decimal) = 2 (hex)
1010 = 10 (decimal) = A (hex)
So 101010 (binary) = 2A (hexadecimal)Hexadecimal to Decimal
To convert FF from hexadecimal to decimal:
F = 15 (decimal)
FF = (15 ร 16ยน) + (15 ร 16โฐ)
= (15 ร 16) + (15 ร 1)
= 240 + 15
= 255
So FF (hexadecimal) = 255 (decimal)Tips for Using Number Base Converter
- โPrefixes: You can include prefixes (0x, 0b, 0o) in your input, or omit them. The converter will automatically detect and handle them.
- โCase Sensitivity: Hexadecimal letters (A-F) are case-insensitive. The converter will automatically uppercase the output.
- โWhitespace: Spaces in your input will be automatically removed during conversion.
- โValidation: The converter validates input according to the selected base to ensure accurate conversions.
- โReal-time: Enable auto-convert for instant conversion as you type, or disable it for manual control.
- โSwap: Use the swap button to quickly exchange the input and output bases.