Binary Calculator

Convert decimal to binary and perform binary arithmetic

Binary Calculator

Convert between decimal and binary

Decimal to Binary

Enter a decimal integer

Formula
Divide by 2 repeatedly and read remainders bottom-to-top

What is a Binary Calculator?

A Binary Calculator is a tool for working with binary numbers, which are numbers written using only two digits: 0 and 1. Binary is the fundamental number system used by computers because digital circuits naturally represent two states (off/on, low/high, 0/1).

Binary numbers follow the same place-value concept as decimal numbers, but instead of powers of 10, binary uses powers of 2. For example, the binary number 1011₂ means: 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11 in decimal.

This Calculator Supports Multiple Conversions

  • Decimal → Binary -- convert base-10 numbers to base-2
  • Decimal → Octal -- convert base-10 numbers to base-8
  • Decimal → Hexadecimal -- convert base-10 numbers to base-16

Binary calculators are useful for converting between number bases, understanding computer science topics like bits, bytes, and data representation, and working with hexadecimal (base 16), which is commonly used to represent binary compactly.

How to Use This Binary Calculator

  1. Enter a decimal number -- type any integer into the input field (e.g., 255)
  2. Click "Calculate" -- to convert the number
  3. Review all three outputs -- the result shows the binary (base 2), octal (base 8), and hexadecimal (base 16) representations simultaneously
  4. Try other values -- explore powers of 2, common byte values (128, 255, 256), or any number you need to convert

Tips:

  • A valid binary number contains only 0 and 1 (no digits 2 through 9)
  • Leading zeros (like 00101) don't change the value, but they can be useful for showing fixed bit-length formats
  • Hexadecimal uses digits 0–9 and letters A–F (where A=10, B=11, …, F=15)

Binary Formulas

Binary Place Value

A binary number has digits (bits) with place values based on powers of 2:

2⁰, 2¹, 2², 2³, 2⁴, …

For binary number bₖbₖ₋₁…b₁b₀, the decimal value is:

value = Σ bᵢ × 2ⁱ (i = 0 to k)

where each bᵢ is either 0 or 1

Converting Decimal to Binary

Repeatedly divide by 2 and record remainders:

  1. Divide the number by 2
  2. Record the remainder (0 or 1)
  3. Divide the quotient by 2 and repeat until the quotient is 0
  4. Read the remainders from bottom to top

Binary Addition Rules

0 + 0 = 0

0 + 1 = 1

1 + 0 = 1

1 + 1 = 10

0 carry 1

Example Calculations

Example 1: Convert Binary to Decimal

Convert: 1011₂ to decimal

Calculation: 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1

Result: 1011₂ = 11₁₀

Example 2: Convert Decimal to Binary

Convert: 13₁₀ to binary

Steps:

  • 13 ÷ 2 = 6 remainder 1
  • 6 ÷ 2 = 3 remainder 0
  • 3 ÷ 2 = 1 remainder 1
  • 1 ÷ 2 = 0 remainder 1

Read upward: 1101

Result: 13₁₀ = 1101₂

Example 3: Binary Addition

Add: 1011₂ + 0101₂

Calculation: 1011 + 0101 = 10000

Verify: 11 + 5 = 16 in decimal

Result: 1011₂ + 0101₂ = 10000₂

Example 4: Binary Multiplication

Multiply: 101₂ × 11₂

In decimal: 5 × 3 = 15

15 in binary: 1111₂

Result: 101₂ × 11₂ = 1111₂

Frequently Asked Questions

Why do computers use binary instead of decimal?

Computers are built from electronic components that naturally represent two states (on/off). Binary matches this perfectly, making it reliable and efficient for hardware design.

What is a bit and a byte?

A bit is a single binary digit (0 or 1). A byte is typically 8 bits, which can represent 256 different values (0–255).

What's the difference between binary and hexadecimal?

Hexadecimal (base 16) is a compact way to write binary. Every 4 binary bits corresponds to one hex digit (0–9 and A–F). For example, 1111₂ = F₁₆.

Can binary numbers represent negative values?

Yes. Computers often use formats like two's complement to represent negative numbers in binary. Some binary calculators support this, but many basic tools focus on non-negative integers.

Why do binary results sometimes look "long"?

Because binary uses only 0 and 1, it needs more digits to represent large numbers. For example, 255₁₀ is 11111111₂, which is 8 bits long.

Embed This Binary Calculator on Your Website

Want to add this binary calculator to your website? Get a custom embed code that matches your site's design and keeps visitors engaged.

Responsive design
Custom styling
Fast loading
Mobile optimized

What Is the Binary Number System?

Binary is the base-2 number system that uses only two digits: 0 and 1. Every piece of digital information — text, images, video, programs — is ultimately stored as sequences of binary digits (bits). Understanding binary is fundamental to computer science and digital electronics. At the hardware level, 0 and 1 map directly to off and on states in transistors, making binary the native language of every processor ever built.

This calculator converts between decimal (the everyday base-10 system) and binary, and can perform binary addition and subtraction. It also shows octal (base 8) and hexadecimal (base 16) equivalents, so you can see how the same value looks across the number systems most commonly used in computing and programming.

How to Use the Binary Calculator

  1. Enter a decimal number to convert it to binary, or enter a binary number (digits 0 and 1 only) to convert it to decimal.
  2. Select the conversion direction: Decimal → Binary or Binary → Decimal.
  3. Click Calculate to see the result.
  4. Read the binary result along with its octal and hexadecimal equivalents displayed below.

Conversion Formulas

Decimal to Binary: divide by 2, collect remainders (LSB first) Example: 13 ÷ 2 = 6 R1, 6 ÷ 2 = 3 R0, 3 ÷ 2 = 1 R1, 1 ÷ 2 = 0 R1 Read remainders bottom to top: 13₁₀ = 1101₂ Binary to Decimal: multiply each bit by 2^position 1101₂ = 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 8+4+0+1 = 13 Binary addition: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (carry 1)

Bits are numbered right to left starting at 0. The leftmost bit is the Most Significant Bit (MSB); the rightmost is the Least Significant Bit (LSB).

Worked Examples

42₁₀ = 101010₂

Divide 42 repeatedly by 2: 42→21 R0, 21→10 R1, 10→5 R0, 5→2 R1, 2→1 R0, 1→0 R1. Reading remainders bottom to top gives 101010. Check: 32+8+2 = 42.

11111111₂ = 255₁₀ (max 8-bit value)

Eight 1-bits = 128+64+32+16+8+4+2+1 = 255. This is the maximum value an unsigned 8-bit byte can hold, which is why IP address octets range from 0 to 255.

1010₂ + 0110₂ = 10000₂ (binary addition: 10 + 6 = 16)

Add column by column from right: 0+0=0, 1+1=10 (write 0 carry 1), 0+1+1=10 (write 0 carry 1), 1+0+1=10 (write 0 carry 1). The carried 1 becomes the leading bit: result is 10000₂ = 16₁₀.

Frequently Asked Questions

Why do computers use binary instead of decimal?
Transistors — the building blocks of all processors and memory — are switches that exist in one of two states: fully on or fully off. Representing those two states as 1 and 0 is the simplest, most reliable approach. Using more than two states would require analog precision and would be far more susceptible to electrical noise and manufacturing variation.
How many values can n bits hold?
With n bits you can represent 2ⁿ distinct values. For example, 1 bit = 2 values (0–1), 8 bits = 256 values (0–255), 16 bits = 65,536 values, 32 bits = ~4.3 billion values, and 64 bits = over 18 quintillion values. For signed integers, half the range is negative: a signed 8-bit integer covers −128 to +127.
What is a byte?
A byte is a group of 8 bits. It is the standard unit of digital storage. One byte can represent 256 different values (0–255 unsigned). Modern file sizes, RAM, and storage capacities are all measured in bytes and their multiples: kilobyte (KB), megabyte (MB), gigabyte (GB), terabyte (TB), and so on.
What is the difference between binary and hexadecimal?
Binary (base 2) uses digits 0–1; hexadecimal (base 16) uses digits 0–9 and letters A–F. Because 16 = 2⁴, each hex digit corresponds exactly to 4 binary bits. This makes hex a compact shorthand for binary: the binary string 11111111 is just FF in hex, which is much easier to read and write in code, memory addresses, and color values.
What is the difference between signed and unsigned binary?
Unsigned binary treats all bits as magnitude, so an 8-bit unsigned number ranges from 0 to 255. Signed binary reserves the most significant bit (MSB) as a sign flag: 0 means positive, 1 means negative. The most common signed encoding is two's complement, where an 8-bit signed integer ranges from −128 to +127. Most programming languages let you choose between signed and unsigned integer types.