Binary Calculator — Free Convert Binary, Decimal, Hex & Octal 2026 | AllInOneTools
01 Free Math Tool

Binary Calculator

Convert between binary, decimal, hexadecimal, and octal. Visualize bits, perform bitwise operations, and see step-by-step base conversion.

Decimal
Binary
Hex
Octal
base 10
Decimal
--
Binary
--
Hex
--
Octal
--
Bits Used
--
Number Systems Reference (0-31)
DecBinaryHexOctASCII
💡 Binary Insight

Binary Calculator: Complete Guide to Number Systems, Base Conversion, and Bitwise Operations

The binary number system is the foundation of all digital computing. Every processor, memory chip, storage device, and network cable operates using binary — sequences of 0s and 1s representing off and on states. Understanding binary and related number systems (decimal, hexadecimal, octal) is essential for computer science, programming, networking, and digital electronics. This calculator converts between all four bases, visualizes individual bits, performs bitwise operations, and explains conversions step by step.

Binary: The Language of Computers

Binary (base-2) uses only two digits: 0 and 1. Each digit position represents a power of 2, just as decimal positions represent powers of 10. From right to left: 2⁰=1, 2¹=2, 2²=4, 2³=8, 2⁴=16, and so on. The binary number 1101 means 1×8 + 1×4 + 0×2 + 1×1 = 13 in decimal. Each binary digit is called a bit. Eight bits form a byte, which can represent values from 0 (00000000) to 255 (11111111). Modern processors work with 64-bit numbers, allowing values up to 2⁶⁴ − 1 ≈ 18.4 quintillion.

Converting Between Bases

Decimal to Binary: repeatedly divide by 2 and record remainders. Read remainders bottom-to-top. For 42: 42÷2=21R0, 21÷2=10R1, 10÷2=5R0, 5÷2=2R1, 2÷2=1R0, 1÷2=0R1. Binary: 101010. Binary to Decimal: multiply each bit by its place value and sum. Hexadecimal (base-16) is a compact binary representation: each hex digit equals exactly 4 bits. A=10, B=11, C=12, D=13, E=14, F=15. So 0xFF = 11111111 = 255. Octal (base-8) groups bits in threes: each octal digit = 3 bits.

Binary to Decimal: Σ bitᵢ × 2ⁱ
1101₂ = 1×8 + 1×4 + 0×2 + 1×1 = 13₁₀

Decimal to Binary: repeated ÷ 2, read remainders
Decimal to Hex: repeated ÷ 16

Hex digits: 0-9, A=10, B=11 ... F=15
Each hex digit = 4 bits | FF = 11111111 = 255
Each octal digit = 3 bits

Bitwise: AND(&) OR(|) XOR(⊕) NOT(~)
1010 AND 1100 = 1000
1010 OR 1100 = 1110
1010 XOR 1100 = 0110

Bitwise Operations

Bitwise operations manipulate individual bits and are fundamental in programming. AND (&): output is 1 only when both inputs are 1. Used for masking — extracting specific bits. OR (|): output is 1 when either input is 1. Used for setting bits. XOR (⊕): output is 1 when inputs differ. Used in encryption, checksums, and toggling. NOT (~): flips all bits. These operations execute in a single CPU clock cycle — the fastest possible computation — making bit manipulation a key optimization technique in systems programming, graphics, and cryptography.

Hexadecimal in Practice

Hexadecimal is the preferred format for representing binary data compactly. Colors: web colors use hex — #FF0000 is red (255 red, 0 green, 0 blue). Memory addresses: 0x7FFFFFFF is a common maximum 32-bit address. MAC addresses: network identifiers like AA:BB:CC:DD:EE:FF. File analysis: hex editors display raw file bytes. Unicode: character codes like U+0041 (letter A). Each hex digit maps to exactly 4 bits, making hex-to-binary conversion trivial: just expand each digit to its 4-bit equivalent.

Binary in Data Storage and Networking

All digital data is binary. A text character might be 1 byte (ASCII) or up to 4 bytes (UTF-8). An image is millions of bytes encoding color values. Storage uses binary prefixes: 1 KB = 1024 bytes = 2¹⁰, 1 MB = 2²⁰, 1 GB = 2³⁰. Network IP addresses are 32-bit binary numbers: 192.168.1.1 = 11000000.10101000.00000001.00000001. Subnet masks use binary patterns to separate network and host portions. Understanding binary arithmetic is essential for network administration, data engineering, and cybersecurity.

How to Use This Calculator

Select input base (Decimal, Binary, Hex, or Octal), enter your number, and click Convert. The calculator shows the number in all four bases simultaneously, visualizes the binary representation as individual bits with place values, and provides summary statistics. Enter a second number for bitwise operations (AND, OR, XOR, NOT). Step-by-step conversion walks through the division algorithm. The reference table shows values 0–31 in all four bases plus ASCII characters.

Two’s Complement: Representing Negative Numbers

Computers represent negative integers using two’s complement: flip all bits and add 1. In 8-bit two’s complement, the range is -128 to +127. The number -5 is represented as: start with 5 (00000101), flip bits (11111010), add 1 (11111011). The most significant bit serves as the sign bit: 0 for positive, 1 for negative. The beauty of two’s complement is that addition works identically for signed and unsigned numbers — the hardware doesn’t need separate circuits. This elegant encoding, invented by John von Neumann, has been the standard since the 1960s and is used in every modern processor.

Boolean Algebra: The Mathematics Behind Digital Logic

Binary computation is built on Boolean algebra, developed by George Boole in 1854. Every digital circuit implements Boolean functions using logic gates: AND gates, OR gates, NOT gates, and their combinations (NAND, NOR, XOR). A full adder circuit, which adds two bits with a carry, uses just two XOR gates, two AND gates, and one OR gate. Modern processors contain billions of these gates fabricated on silicon wafers. The simplicity of binary — just two states — is what makes this massive integration possible. Understanding Boolean algebra and binary arithmetic is the foundation of computer engineering, digital design, and the entire modern computing industry.

Binary Arithmetic: Addition, Subtraction, and Beyond

Binary arithmetic follows the same rules as decimal but with only two digits. Addition: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (carry the 1). Subtraction uses borrowing or two’s complement addition. Multiplication is simplified because multiplying by 0 or 1 requires no computation — just shifting and adding. Left-shifting a binary number by n positions multiplies by 2^n (101 << 2 = 10100, i.e., 5×4=20). Right-shifting divides by 2^n. These bit-shift operations are the fastest arithmetic operations a processor can perform and are heavily used in graphics programming, signal processing, and cryptographic algorithms.

Computer Science Note
This calculator handles unsigned integers up to 32 bits (0 to 4,294,967,295). For negative numbers, computers use two's complement representation. The bitwise NOT shows one's complement (all bits flipped).

Frequently Asked Questions

Binary to decimal?
Multiply each bit by power of 2, sum. 1011 = 8+0+2+1 = 11.
Decimal to binary?
Divide by 2 repeatedly, record remainders, read bottom-up. 13→1101.
What is hexadecimal?
Base-16: 0-9 then A=10 to F=15. Each hex digit = 4 bits. FF=255.
Bitwise operations?
AND (both 1→1), OR (either→1), XOR (different→1), NOT (flip).
Why binary?
Electronics = 2 states on/off. All data is binary. 8 bits = 1 byte = 256 values.