Number System Converter
Convert between decimal, binary, hexadecimal, and more
Number System Converter
Converting from Decimal to Base 2
Convert each digit by repeatedly dividing by 2 and taking remainders
Example: 42 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 bottom-up: 101010
Bit Value Breakdown:
Recent Conversions:
Common Number Systems
| Base | Name | Digits | Programming | Example |
|---|---|---|---|---|
| 2 | Binary | 0, 1 | 0b1010 | 1010 = 10 (decimal) |
| 8 | Octal | 0-7 | 0o12 | 12 = 10 (decimal) |
| 10 | Decimal | 0-9 | 10 | 10 = 10 (decimal) |
| 16 | Hexadecimal | 0-9, A-F | 0xA | A = 10 (decimal) |
Number Systems in Programming
Different programming languages use specific prefixes to denote non-decimal number literals:
JavaScript / Python / C
0b1010- Binary (base 2)0o12- Octal (base 8)0xA- Hexadecimal (base 16)
Conversion Functions
- JavaScript:
parseInt("1010", 2) - Python:
int("1010", 2) - C#:
Convert.ToInt32("1010", 2)
Bitwise operations in programming use binary representation internally, making understanding binary essential for tasks like bit manipulation, flags, and low-level optimizations.
Binary to Decimal Conversion
Each binary digit (bit) represents a power of 2:
| Bit position | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Power of 2 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| Example: 42 (decimal) | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 |
| Value | 0 | 0 | 32 | 0 | 8 | 0 | 2 | 0 |
32 + 8 + 2 = 42 (decimal)
Binary-Hex-Decimal Equivalence
Common conversions between binary, hexadecimal, and decimal:
| Decimal | Binary | Hexadecimal |
|---|---|---|
| 0 | 0000 | 0 |
| 1 | 0001 | 1 |
| 2 | 0010 | 2 |
| 3 | 0011 | 3 |
| 4 | 0100 | 4 |
| 5 | 0101 | 5 |
| 6 | 0110 | 6 |
| 7 | 0111 | 7 |
| 8 | 1000 | 8 |
| 9 | 1001 | 9 |
| 10 | 1010 | A |
| 11 | 1011 | B |
| 12 | 1100 | C |
| 13 | 1101 | D |
| 14 | 1110 | E |
| 15 | 1111 | F |
Was this converter helpful? Let us know how we can improve it!
☕ Support UnitGenie
If this tool has been helpful, consider buying me a coffee to support development and keep it free for everyone!
Number System Visualization
Data Size
Approximately 7 bits
ASCII character (8 bits)
Base 10 Information
Quick Reference
Decimal to Binary Chart
Hex to Binary Chart
Useful Formulae
Real-World Use Cases
Mobile tip: Swipe left or right on the base dropdown to quickly change number systems, or use the arrow buttons
About the Number System Converter
Convert between decimal, binary, hexadecimal, and more All conversions run instantly in your browser and nothing you enter is sent to a server.
Common Conversion Formulas
| From | To | Formula |
|---|---|---|
| Decimal (Base 10) | Binary (Base 2) | Divide by 2 repeatedly, read remainders bottom-up |
| Decimal (Base 10) | Hexadecimal (Base 16) | Divide by 16 repeatedly, read remainders bottom-up |
| Binary (Base 2) | Decimal (Base 10) | Sum of (bit × 2^position) from right to left |
Related calculators
- Hex CalculatorAdd, subtract, multiply and divide hexadecimal, binary, octal or decimal numbers, and apply bitwise AND, OR and XOR. Results in all four bases.
- Binary Translator: Text to BinaryConvert text to binary code and binary back to text. Uses 8-bit bytes with UTF-8, so it handles ASCII and every other character.
- Text to ASCII and Unicode ConverterConvert text to ASCII codes and Unicode code points in decimal and hex, or turn a list of character codes back into text.