Skip to content

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

BaseNameDigitsProgrammingExample
2Binary0, 10b10101010 = 10 (decimal)
8Octal0-70o1212 = 10 (decimal)
10Decimal0-91010 = 10 (decimal)
16Hexadecimal0-9, A-F0xAA = 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 position76543210
Power of 21286432168421
Example: 42 (decimal)00101010
Value003208020

32 + 8 + 2 = 42 (decimal)

Binary-Hex-Decimal Equivalence

Common conversions between binary, hexadecimal, and decimal:

DecimalBinaryHexadecimal
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
101010A
111011B
121100C
131101D
141110E
151111F

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

Decimal2 digits
4
1
Digit Info
Position:1
Place value:10^1 = 10
Digit value:4
Total:4 × 10 = 40
2
0
Digit Info
Position:0
Place value:10^0 = 1
Digit value:2
Total:2 × 1 = 2
Hover over each digit to see its place value and contribution
Binary6 digits
1
5
Digit Info
Position:5
Place value:2^5 = 32
Digit value:1
Total:1 × 32 = 32
0
4
Digit Info
Position:4
Place value:2^4 = 16
Digit value:0
Total:0 × 16 = 0
1
3
Digit Info
Position:3
Place value:2^3 = 8
Digit value:1
Total:1 × 8 = 8
0
2
Digit Info
Position:2
Place value:2^2 = 4
Digit value:0
Total:0 × 4 = 0
1
1
Digit Info
Position:1
Place value:2^1 = 2
Digit value:1
Total:1 × 2 = 2
0
0
Digit Info
Position:0
Place value:2^0 = 1
Digit value:0
Total:0 × 1 = 0

Data Size

Approximately 7 bits

ASCII character (8 bits)

Decimal Value
42
Hex Equivalent
2A

Base 10 Information

Number of digits:10
Bits per digit:4
Programming prefix:none
Digital representation:
~4 bits per digit
Example:
In base 10, each digit position represents a power of 10

Quick Reference

Decimal to Binary Chart

0
0000
1
0001
2
0010
3
0011
4
0100
5
0101
6
0110
7
0111
8
1000
9
1001
10
1010
11
1011
12
1100
13
1101
14
1110
15
1111

Hex to Binary Chart

0
0000
1
0001
2
0010
3
0011
4
0100
5
0101
6
0110
7
0111
8
1000
9
1001
A
1010
B
1011
C
1100
D
1101
E
1110
F
1111

Useful Formulae

Base-n to Decimal
value = Σ (digit_i × base^position_i)
Number of bits needed
bits = log₂(n)
Where n is the highest number to represent
Binary/Hex Conversion
1 hex digit = 4 binary digits
Powers of 2
2⁸ = 256, 2¹⁰ = 1024, 2¹⁶ = 65536

Real-World Use Cases

Binary (Base 2)
Computer circuits, digital logic, data storage
Hexadecimal (Base 16)
Memory addresses, RGB colors, cryptography
Base 64
Email attachments, data URLs, web tokens
Historical Systems
Base 60 (time, angles), Base 12 (dozen, feet/inches)

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

FromToFormula
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

☕ Like this tool?

Buy me a coffee to support development