UseCalcPro
Home
Math
Percentages, fractions, ratios
Finance
Loans, mortgages, investments
Health
BMI, calories, fitness metrics
Construction
Materials for building projects
Auto
Car payments, fuel, insurance
Pets
Pet age, feeding, housing
Garden
Lawn care, irrigation, compost
Crafts
Yarn, fabric, candle making
Food & Brewing
Bread, dough, brewing, recipes
Tools
Age, date, GPA, converters
Blog
  1. Home
  2. Math

Binary Calculator

Convert between decimal, binary, hexadecimal, and octal with bitwise operations

Decimal

42

Binary

101010

Hex

2A

Octal

52

Decimal

42

Binary

101010

Hexadecimal

2A

Octal

52

ASCII Character

*

Bit Visualization

0
0
1
0
1
0
1
0
27
26
25
24
23
22
21
20

8-bit — 3 bits set

Formulas Used

Decimal to Binary

Repeatedly divide by 2, record remainders (read bottom to top)

Divide the decimal number by 2 repeatedly. The remainders (0 or 1) read from bottom to top form the binary representation.

Where:

n= The decimal number to convert
remainder= n % 2 at each step (0 or 1), forms binary digits

Binary to Decimal

decimal = Σ(bit × 2^position)

Multiply each binary digit by 2 raised to its position (right to left, starting at 0), then sum all products.

Where:

bit= Each binary digit (0 or 1)
position= Position index from right, starting at 0

Example Calculations

1Convert Decimal 42 to Binary

Inputs

ModeDecimal → Binary
Decimal Number42

Result

Binary101010

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 to top: 101010.

2Convert Binary 11111111 to Decimal

Inputs

ModeBinary → Decimal
Binary Number11111111

Result

Decimal255

1×128 + 1×64 + 1×32 + 1×16 + 1×8 + 1×4 + 1×2 + 1×1 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. This is the maximum value for an 8-bit byte.

3Convert Decimal 1024 to Binary

Inputs

ModeDecimal → Binary
Decimal Number1024

Result

Binary10000000000
Hexadecimal400
Octal2000
Bits11 bits

1024 = 2¹⁰. In binary, this is a 1 followed by 10 zeros: 10000000000. This is exactly 1 KB (kilobyte) in computing. Hex: 400, Octal: 2000.

4Bitwise AND: 42 & 15

Inputs

ModeBitwise Operation
Operand A42
OperationAND (&)
Operand B15

Result

Result10 (decimal)
Binary Result00001010
A in Binary00101010
B in Binary00001111

42 in binary = 00101010, 15 in binary = 00001111. AND compares each bit: both must be 1 to produce 1. Result: 00001010 = 10 decimal. AND is commonly used for bit masking.

Frequently Asked Questions

Q

What is binary and why do computers use it?

Binary is base-2 using only 0 and 1. Computers use it because transistors have two states: on (1) or off (0). Everything in a computer (text, images, programs) is ultimately stored as binary. Each digit is called a "bit."

  • Base-2: Only digits 0 and 1
  • Bit: Single binary digit
  • Byte: 8 bits (e.g., 10110010)
  • Why: Transistors are on/off switches
  • Everything digital is binary "under the hood"
Number SystemBaseDigits UsedExample (decimal 10)
Binary20, 11010
Octal80-712
Decimal100-910
Hexadecimal160-9, A-FA
Q

How do I convert decimal to binary?

Repeatedly divide by 2, record remainders. Read remainders from bottom to top. Example: 13 → 13÷2=6 R1, 6÷2=3 R0, 3÷2=1 R1, 1÷2=0 R1. Read up: 1101. So 13 in binary is 1101.

  • Divide by 2, record remainder (0 or 1)
  • Continue until quotient is 0
  • Read remainders bottom to top
  • Example: 13 = 1101 in binary
  • Quick check: Add powers of 2 (8+4+1=13 ✓)
DecimalConversion StepsBinary
55→2R1, 2→1R0, 1→0R1101
1010→5R0, 5→2R1, 2→1R0, 1→0R11010
2525→12R1, 12→6R0, 6→3R0, 3→1R1, 1→0R111001
100100→50→25→...1100100
Q

How do I convert binary to decimal?

Multiply each digit by its power of 2 (right to left: 1, 2, 4, 8, 16...), then add. Example: 1101 = 1×8 + 1×4 + 0×2 + 1×1 = 8+4+0+1 = 13.

  • Powers of 2: 1, 2, 4, 8, 16, 32, 64, 128...
  • Rightmost digit = 2⁰ = 1
  • Next left = 2¹ = 2, then 4, 8, 16...
  • Multiply each bit by its position value
  • Add all products together
BinaryCalculationDecimal
1011×4 + 0×2 + 1×15
10108 + 0 + 2 + 010
11118 + 4 + 2 + 115
1000016 + 0 + 0 + 0 + 016
11111111128+64+32+16+8+4+2+1255
Q

What are common binary values to memorize?

Key powers of 2: 2=10, 4=100, 8=1000, 16=10000, 32=100000, 64=1000000, 128=10000000, 256=100000000. Also: 255=11111111 (max 8-bit), 1023=10 ones (max 10-bit).

  • 8 bits = 1 byte (0-255)
  • 255 = 11111111 (all ones in a byte)
  • IP addresses: 4 bytes (0-255 each)
  • RGB colors: 0-255 each channel
  • 1 KB = 1024 bytes (2¹⁰)
DecimalBinarySignificance
112⁰
2102¹
41002²
810002³
16100002⁴
25511111111Max 8-bit (1 byte)
2561000000002⁸
Q

How do I add and subtract binary numbers?

Same as decimal but only 0 and 1. Addition: 0+0=0, 0+1=1, 1+1=10 (carry 1). Subtraction: Similar, with borrowing. Example: 101 + 11 = 1000 (5+3=8).

  • Binary addition: 0+0=0, 0+1=1, 1+0=1, 1+1=10
  • Carry the 1 just like decimal
  • 101 + 11 = 1000 (5 + 3 = 8)
  • 1111 + 1 = 10000 (15 + 1 = 16)
  • Two's complement for negative numbers
OperationBinaryDecimal Check
101 + 101115 + 2 = 7
101 + 1110005 + 3 = 8
1111 + 11000015 + 1 = 16
1010 - 1111110 - 3 = 7
Q

What is hexadecimal and how does it relate to binary?

Hexadecimal (hex) is base-16 using 0-9 and A-F. Each hex digit = 4 binary bits. F = 1111 = 15. Hex is easier to read than long binary. Color #FF00FF = 11111111 00000000 11111111.

  • Hex digits: 0-9, then A=10, B=11...F=15
  • 1 hex digit = 4 bits (nibble)
  • 2 hex digits = 8 bits (1 byte)
  • Colors: #RRGGBB (each pair = 0-255)
  • Memory addresses often shown in hex
HexBinary (4 bits)Decimal
000000
501015
910019
A101010
F111115
FF11111111255

Understanding Binary Numbers

Binary is the foundation of all digital computing systems.

Every piece of data in a computer is ultimately stored as binary digits (bits).

Understanding binary helps with programming, computer science, and digital electronics.

Related Calculators

Percentage Calculator

Calculate percentages and conversions

Fraction Calculator

Convert fractions to decimals and back

Unit Converter

Convert between different measurement units

Last Updated: Feb 13, 2026

This calculator is provided for informational and educational purposes only. Results are estimates and should not be considered professional financial, medical, legal, or other advice. Always consult a qualified professional before making important decisions. UseCalcPro is not responsible for any actions taken based on calculator results.

UseCalcPro
FinanceHealthMath

© 2026 UseCalcPro