Expert Reviewed
Prof. Emily Rodriguez, Ph.D. MathematicsUpdated June 1, 2026Our Standards →

Last updated:

Binary Calculator

Convert decimal to binary, hex, and octal instantly. Perform binary addition, subtraction, and more. Free online binary calculator, 2026.

Back to Math

Binary Calculator

Ad-FreeAI-Powered

Free online binary calculator — convert and calculate between binary, decimal, octal, and hexadecimal with AI-powered insights.

Enter values above to see results.

About This Calculator

Related Articles

🔢 Binary Calculator — Complete Guide

Base 2
Binary number system (0s and 1s)
Base 16
Hexadecimal (0–9, A–F)
AND/OR/XOR
Fundamental bitwise operations
Two's Comp
Standard signed integer encoding

Number Base Systems

BaseNameDigitsExample
2Binary0–11010₂ = 10₁₀
8Octal0–712₈ = 10₁₀
10Decimal0–910₁₀ = 10₁₀
16Hexadecimal0–9, A–FA₁₆ = 10₁₀

Myths vs Facts

MYTH: Binary is only used by computers
FACT: Binary encoding underpins all digital electronics: logic gates, CPUs, storage, networking, and cryptography. Understanding binary is fundamental to computer science.
MYTH: Hexadecimal is more complex than binary
FACT: Hex (base 16) is actually a shorthand for binary — each hex digit represents exactly 4 binary bits. Programmers prefer hex because it's more compact and readable than long binary strings.

Frequently Asked Questions

How do I convert binary to decimal?

Multiply each binary digit by 2 raised to its positional value (from right, starting at 0), then sum. E.g., 1011₂ = 1×8 + 0×4 + 1×2 + 1×1 = 11₁₀.

What is a bitwise AND operation?

AND compares bits position-by-position: the result bit is 1 only if BOTH input bits are 1. E.g., 1010 AND 1100 = 1000. Used for masking specific bits in low-level programming.

What is XOR used for?

XOR (exclusive OR) outputs 1 when bits differ. It's used in encryption algorithms, checksums, RAID parity, and simple bit-swapping without a temporary variable.

What is two's complement?

Two's complement is the standard way to represent negative integers in binary. Negate a number by inverting all bits (one's complement) then adding 1. It allows CPUs to use the same addition circuit for both positive and negative numbers.

Why do computers use binary?

Digital circuits have two stable voltage states (high/low, on/off). Binary maps perfectly to this: 1 = high voltage, 0 = low voltage. Boolean algebra (AND, OR, NOT) provides the mathematical foundation for all logic operations.

How does hexadecimal relate to binary?

Each hex digit represents exactly 4 binary bits (a "nibble"). FF₁₆ = 11111111₂. Programmers use hex to represent memory addresses, color codes (RGB), and machine code compactly.

What is octal used for?

Octal (base 8) is used in Unix/Linux file permissions (e.g., chmod 755). Each octal digit represents 3 binary bits. It was more common in early computing but largely replaced by hexadecimal.

How do I add binary numbers?

Binary addition follows the same rules as decimal but with only 0s and 1s: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (carry 1). E.g., 1011 + 0110 = 10001.

Explore All Math Calculators

Reviewed by CalculatorApp.me Math Team

Binary Calculator — Complete Guide

Convert between binary, decimal, hexadecimal, and octal. Understand bitwise operations, two's complement, and how computers represent data.

0 & 1

Two binary digits

2⁸ = 256

One byte range

IEEE 754

Float standard

UTF-8

Text encoding

Understanding Binary (Base 2)

The binary number system (base 2) uses only two digits: 0 and 1. Each digit (called a bit) represents a power of 2. Binary is the foundation of all digital computing — processors, memory, storage, and networking all operate on binary data.

In the decimal system (base 10), the number 347 means 3×10² + 4×10¹ + 7×10⁰. Similarly, in binary, 1101₂ means 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 8 + 4 + 0 + 1 = 13₁₀.

Grouping bits creates larger units: 4 bits = a nibble (0–15), 8 bits = a byte (0–255), 16 bits = a word (historical), 32 bits = a dword, 64 bits = a qword. Modern processors work with 64-bit integers natively, handling values up to 2⁶⁴ − 1 = 18,446,744,073,709,551,615.

Number Base Conversions

Decimal → Binary
Repeated Division by 2:

  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

  Read remainders bottom→top:
  42₁₀ = 101010₂

Verify: 32+0+8+0+2+0 = 42 ✓

For fractions:
  0.625 × 2 = 1.25  → 1
  0.25  × 2 = 0.5   → 0
  0.5   × 2 = 1.0   → 1
  0.625₁₀ = 0.101₂

The repeated-division method works for any base conversion. For fractions, multiply by the target base instead and read integer parts top→bottom.

Binary → Hex (Base 16)
Group bits into nibbles (4 bits):

Binary:  1010  1111  0011  1100
Hex:      A     F     3     C

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

Examples:
  1111 1111₂ = FF₁₆ = 255₁₀
  0001 0000₂ = 10₁₆ = 16₁₀
  1100 1010₂ = CA₁₆ = 202₁₀

Hex is compact representation:
  32-bit address in binary: 32 chars
  Same in hex: only 8 chars
  0xDEADBEEF = 11011110...

Hexadecimal is the standard shorthand for binary data. Memory addresses, color codes (#FF5733), MAC addresses (AA:BB:CC:DD:EE:FF), and debug output all use hex.

Binary → Octal (Base 8)
Group bits into triplets (3 bits):

Binary:  101  010  111  100
Octal:    5    2    7    4

  000=0  010=2  100=4  110=6
  001=1  011=3  101=5  111=7

Examples:
  111 111 111₂ = 777₈ = 511₁₀
  001 000₂     = 10₈  = 8₁₀

Unix File Permissions (octal):
  chmod 755 = rwxr-xr-x
  7 = 111₂ = rwx (read+write+exec)
  5 = 101₂ = r-x (read+exec)
  4 = 100₂ = r-- (read only)
  0 = 000₂ = --- (no permissions)

Octal (base 8) maps cleanly to 3-bit groups. Its primary modern use is Unix file permissions: 644, 755, 777 are all octal representations of 9-bit permission sets.

IEEE 754 Floating Point
32-bit float layout:
┌─┬──────────┬───────────────────────┐
│S│ Exponent │     Mantissa          │
│1│ 8 bits   │     23 bits           │
└─┴──────────┴───────────────────────┘

Value = (-1)ˢ × 1.mantissa × 2^(exp-127)

Example: 6.5₁₀
  6.5 = 110.1₂ = 1.101 × 2²
  Sign: 0 (positive)
  Exponent: 2 + 127 = 129 = 10000001₂
  Mantissa: 10100000000000000000000

  Full: 0 10000001 10100000000000000000000
  Hex:  0x40D00000

Special values:
  0 00000000 000...0 = +0
  0 11111111 000...0 = +∞
  0 11111111 1xx...x = NaN

64-bit double: 1+11+52 bits
  Precision: ~15-16 decimal digits

IEEE 754 (1985) standardized floating-point arithmetic worldwide. The infamous 0.1 + 0.2 ≠ 0.3 is because 0.1 has an infinite binary expansion, causing unavoidable rounding.

Bitwise Operations

OperationSymbolExample (Binary)ResultUse Case
AND&1100 & 10101000Masking bits, checking flags
OR|1100 | 10101110Setting flags, combining masks
XOR^1100 ^ 10100110Toggle bits, encryption, swap
NOT~~11000011Invert all bits (one's complement)
Left Shift<<0011 << 21100Multiply by 2ⁿ (fast power of 2)
Right Shift>>1100 >> 20011Divide by 2ⁿ (integer division)
Unsigned Right Shift>>>1100 >>> 10110Shift with zero-fill (no sign extend)

Bitwise operations execute in a single CPU clock cycle — far faster than arithmetic equivalents. They're fundamental to device drivers, compression algorithms, hash functions, and graphics programming.

Two's Complement (Signed Integers)

Binary (8-bit)Unsigned ValueSigned ValueNotes
0000 000000Zero
0000 00011+1Smallest positive
0111 1111127+127Largest positive (signed 8-bit)
1000 0000128−128Most negative (signed 8-bit)
1111 1110254−2Invert bits of 2, add 1
1111 1111255−1All bits set
0 to 255−128 to +1278-bit range comparison

To negate in two's complement: flip all bits (NOT), then add 1. Example: +5 = 00000101 → flip → 11111010 → add 1 → 11111011 = −5. This system makes addition/subtraction hardware identical for signed and unsigned numbers.

Data Types & Storage Sizes

TypeBitsUnsigned RangeSigned RangeCommon Use
byte / int880 – 255−128 to 127Pixel channels, ASCII
short / int16160 – 65,535−32,768 to 32,767Audio samples, sensor data
int / int32320 – 4.29×10⁹−2.15×10⁹ to 2.15×10⁹Loop counters, IDs
long / int64640 – 1.84×10¹⁹−9.22×10¹⁸ to 9.22×10¹⁸Timestamps, file sizes
float3232±1.18×10⁻³⁸ to ±3.4×10³⁸~7 decimal digitsGPU, ML weights
float64 (double)64±2.2×10⁻³⁰⁸ to ±1.8×10³⁰⁸~15 decimal digitsScientific, financial

History of Binary Numbers

~300 BC

Pingala — Binary in Indian Prosody

The Indian mathematician Pingala used a binary-like system (laghu/guru, short/long syllables) to classify Sanskrit meters. His Chandaḥśāstra describes a system equivalent to binary numbers, predating Leibniz by nearly 2,000 years.

1703

Leibniz — Formal Binary System

Gottfried Wilhelm Leibniz published 'Explication de l'Arithmétique Binaire', the first formal description of the binary number system. He demonstrated all arithmetic (addition, subtraction, multiplication, division) in base 2. He was inspired by the Chinese I Ching hexagrams.

1854

Boole — Boolean Algebra

George Boole published 'An Investigation of the Laws of Thought', creating Boolean algebra. His binary logic (TRUE/FALSE, 1/0) with AND, OR, NOT operations became the mathematical foundation for all digital circuits and computer science.

1937

Shannon — Boolean Logic in Circuits

Claude Shannon's MIT master's thesis showed that Boolean algebra could be implemented with electrical relay circuits. This breakthrough connected Boole's abstract mathematics to physical hardware, making digital computers possible.

1945

Von Neumann — Binary Computer Architecture

John von Neumann's EDVAC report described a stored-program computer using binary arithmetic and memory. The von Neumann architecture — where both programs and data are stored in binary memory — remains the basis of virtually all modern computers.

1985

IEEE 754 — Floating-Point Standard

The IEEE published Standard 754 for floating-point arithmetic, standardizing how computers represent real numbers in binary. This eliminated incompatibilities between hardware vendors and established the 32-bit float / 64-bit double formats used universally today.

Key Research & Data

Myths vs. Facts

Computers 'think' in binary — they understand 0s and 1s.

Computers don't 'understand' anything. They're physical circuits where voltage levels (e.g., 0V vs 5V) represent 0 and 1. Transistors switch on/off — no comprehension involved. Binary is the mathematical abstraction we use to describe electrical states.

1 KB = 1000 bytes.

Historically, 1 KB = 1024 bytes (2¹⁰) because binary powers are natural for computers. The IEC standard introduced KiB (kibibyte) = 1024 bytes vs. KB (kilobyte) = 1000 bytes to resolve ambiguity. Storage manufacturers use 1000; RAM uses 1024.

Binary is too limited since it only has two digits.

Binary can represent ANY information: all numbers, text, images, video, and programs are encoded in binary. Two digits is sufficient because position provides the complexity — 64 binary digits can represent 2⁶⁴ ≈ 1.8×10¹⁹ distinct values.

Floating-point numbers are always accurate in binary.

Many decimal fractions have infinite binary representations (e.g., 0.1₁₀ = 0.0001100110011...₂ repeating). This causes the infamous 0.1 + 0.2 = 0.30000000000000004 issue. For exact decimal arithmetic (finance), use integer cents or dedicated decimal libraries.

Frequently Asked Questions

How do I convert decimal to binary?
Divide the number by 2 repeatedly, recording remainders. Read remainders from bottom to top. Example: 25 → 25÷2=12r1, 12÷2=6r0, 6÷2=3r0, 3÷2=1r1, 1÷2=0r1 → 11001₂. For fractions, multiply by 2 and read integer parts top to bottom.
What is a byte?
A byte is 8 bits — the standard addressable unit of memory. It can represent values 0–255 (unsigned) or −128 to 127 (signed). One byte stores one ASCII character. The prefix 'kilo-' in kilobyte means either 1000 or 1024 bytes depending on context.
What are hexadecimal numbers?
Hexadecimal (base 16) uses digits 0-9 and letters A-F (10-15). Each hex digit maps to exactly 4 binary bits, making it a compact notation for binary data. Example: 0xFF = 1111 1111₂ = 255₁₀. Used for colors (#FF5733), memory addresses, debug output.
Why do computers use binary instead of decimal?
Transistors are most reliable as switches (on/off = 1/0). Binary circuits are simple, fast, and noise-resistant. A decimal circuit would need 10 distinct voltage levels per digit — vastly more complex and error-prone. Binary's simplicity enabled the miniaturization that created modern computing.
What is two's complement?
The standard method for representing negative integers in binary. To negate: flip all bits and add 1. Advantages: only one representation of zero, and addition hardware works identically for positive and negative numbers. Used by all modern processors.
What does 0.1 + 0.2 ≠ 0.3 mean in binary?
The decimal 0.1 has an infinite repeating binary representation (0.000110011...). When stored in finite bits (IEEE 754 double), it's rounded. Adding two rounded values produces 0.30000000000000004 instead of exactly 0.3. This affects ALL languages using IEEE 754.
What is Big Endian vs Little Endian?
Byte order in multi-byte values. Big Endian: most significant byte first (0x12345678 stored as 12 34 56 78). Little Endian: least significant first (78 56 34 12). x86/ARM use Little Endian; network protocols use Big Endian (network byte order).
How do binary operations work in programming?
Languages like C, JavaScript, Python support bitwise operators: & (AND), | (OR), ^ (XOR), ~ (NOT), << (left shift), >> (right shift). These operate on individual bits and are used for flags, masks, compression, hashing, and performance optimization.
What is ASCII vs Unicode?
ASCII (1963) maps 128 characters to 7-bit binary codes (A=65=1000001₂). Unicode (1991) extends this to 154,998+ characters covering all scripts. UTF-8 encoding uses 1-4 bytes per character and is backward-compatible with ASCII. Over 98% of websites use UTF-8.
How does binary relate to logic gates?
Logic gates (AND, OR, NOT, XOR, NAND, NOR) process binary signals physically. An AND gate outputs 1 only if both inputs are 1. Billions of gates combined create processors, memory, and all digital hardware. Every computation reduces to logic gate operations on binary values.
What is BCD (Binary-Coded Decimal)?
BCD encodes each decimal digit in 4 binary bits: 9 = 1001, 42 = 0100 0010. Unlike pure binary, BCD preserves decimal digit boundaries. Used in financial calculators, clocks, and systems requiring exact decimal representation. Less space-efficient than pure binary.
What are binary file formats?
Binary files store data as raw bytes rather than human-readable text. Examples: images (PNG, JPEG), audio (MP3, WAV), executables (.exe, ELF), databases. Binary formats are more compact and faster to parse than text formats but require specific software to read.

References

Related Calculators

Explore All Math Calculators

Binary conversions, bitwise operations, and number systems — CalculatorApp.me.

Browse Math Calculators →

See Also