Binary Arithmetic & Conversion
Last reviewed: April 2026
A binary calculator performs arithmetic operations — addition, subtraction, multiplication, and division — on binary (base-2) numbers. It also converts between binary, decimal, octal, and hexadecimal representations, making it useful for computer science students and programmers.
Binary is a base-2 number system that uses only 0 and 1, forming the foundation of all digital computing. Every file, image, and program on a computer is ultimately stored and processed as sequences of binary digits (bits).[1] Converting between binary and decimal involves powers of 2 — each binary digit position represents 2^n, where n is the position from right to left starting at 0.[2] Hexadecimal (base-16) is commonly used as a shorthand for binary because each hex digit maps to exactly four binary digits, making long binary strings much easier to read and debug.[3] Use the Hex Calculator for hexadecimal arithmetic.
Every piece of data in a computer — text, images, video, programs — is ultimately stored and processed as binary. A single binary digit (bit) represents one on/off state. Eight bits form a byte, capable of representing 256 different values (2⁸). Understanding binary is essential for programming (bitwise operations, flags, permissions), networking (IP addresses, subnet masks), data storage (file sizes, memory addressing), and color representation (each RGB channel is one byte, 0–255). Hexadecimal is commonly used as shorthand for binary because each hex digit maps to exactly four binary digits. Convert between number systems with our Number Base Converter.
| Decimal | Binary | Hexadecimal | Octal |
|---|---|---|---|
| 1 | 0001 | 1 | 1 |
| 8 | 1000 | 8 | 10 |
| 16 | 10000 | 10 | 20 |
| 64 | 1000000 | 40 | 100 |
| 128 | 10000000 | 80 | 200 |
| 255 | 11111111 | FF | 377 |
The binary (base-2) number system uses only two digits — 0 and 1 — to represent all values. Each digit position (bit) represents a power of 2, just as each position in the decimal system represents a power of 10. The binary number 1101 equals 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 8 + 4 + 0 + 1 = 13 in decimal. Binary is the native language of digital computers because electronic circuits have two natural states — on/off, high voltage/low voltage, charged/uncharged — making binary representation physically simple to implement and highly reliable. Every number, text character, image pixel, sound sample, and instruction that a computer processes is ultimately represented as a sequence of binary digits.
The binary system has ancient roots — the I Ching, an ancient Chinese text dating to approximately 1000 BCE, uses a binary-like system of broken and unbroken lines. Gottfried Wilhelm Leibniz formally described the modern binary number system in 1703 and recognized its potential for calculation. Claude Shannon's 1937 master's thesis demonstrated that Boolean algebra (true/false logic) could be implemented with electrical switches, laying the theoretical foundation for digital computing. Today, binary computation powers virtually every electronic device from smartphones to supercomputers.
Binary arithmetic follows the same principles as decimal arithmetic but with only two digits. Binary addition has four cases: 0+0=0, 0+1=1, 1+0=1, and 1+1=10 (carry the 1). Adding 1011 + 1101: starting from the right, 1+1=10 (write 0, carry 1), 1+0+1(carry)=10 (write 0, carry 1), 0+1+1(carry)=10 (write 0, carry 1), 1+1+1(carry)=11 (write 1, carry 1). Result: 11000 (decimal: 11+13=24). Binary subtraction uses borrowing, where borrowing from the next column gives 2 (since we are in base 2) rather than 10 as in decimal.
Binary multiplication is simpler than decimal multiplication because each partial product is either 0 (multiplying by 0) or a copy of the multiplicand (multiplying by 1), shifted by the appropriate number of positions. This simplicity is why multiplication circuits in processors are built from combinations of shift and add operations. Binary division follows long division procedures but with only two possible quotient digits at each step (0 or 1), making the trial-and-error aspect of long division trivial compared to decimal division. Our Scientific Notation Calculator and Roman Numeral Converter handle other number representation systems.
While computers operate in binary, humans find long binary strings difficult to read and manage. Octal (base-8) and hexadecimal (base-16) provide compact representations that convert directly to and from binary. Each octal digit represents exactly 3 binary digits (since 2³ = 8), and each hexadecimal digit represents exactly 4 binary digits (since 2⁴ = 16). The binary number 11010110 converts to hexadecimal by grouping into 4-bit chunks: 1101 0110 = D6 (where D represents decimal 13). This direct correspondence makes hex the preferred notation for memory addresses, color codes (web colors like #FF5733), and byte-level data inspection.
Hexadecimal uses digits 0-9 and letters A-F, where A=10, B=11, C=12, D=13, E=14, F=15. Common hexadecimal values encountered in computing include 0xFF (255 in decimal, the maximum value of a single byte), 0x7F (127, the maximum value of a signed byte), and 0x00 (zero). Understanding these number bases is essential for programming, networking (IP addresses, MAC addresses), digital design, and any field involving direct interaction with computer hardware or low-level software.
At the hardware level, computer processors manipulate binary data through logic gates — electronic circuits that implement Boolean operations (AND, OR, NOT, XOR). An AND gate outputs 1 only if both inputs are 1. An OR gate outputs 1 if either input is 1. A NOT gate inverts its input. Combinations of these gates create circuits that perform addition, comparison, memory storage, and every other computation. A modern processor contains billions of transistors arranged into these logic gate patterns, executing billions of binary operations per second.
Data types in computing are defined by how many binary digits they use. A bit is a single binary digit. A byte is 8 bits, representing values 0-255 (unsigned) or -128 to 127 (signed). A 16-bit integer represents values 0-65,535. A 32-bit integer handles values up to approximately 4.3 billion. A 64-bit integer extends to approximately 18.4 quintillion. Characters are encoded using standards like ASCII (7-bit, 128 characters) and Unicode (up to 32-bit, over 149,000 characters covering virtually every writing system). Floating-point numbers use the IEEE 754 standard, encoding sign, exponent, and mantissa in 32-bit (single precision) or 64-bit (double precision) formats.
Network communication relies fundamentally on binary encoding. IPv4 addresses, typically written in dotted-decimal notation (192.168.1.1), are actually 32-bit binary numbers. Subnet masks determine which portion of an IP address identifies the network versus the host by masking with binary AND operations — a /24 subnet mask (255.255.255.0) in binary is 11111111.11111111.11111111.00000000, indicating the first 24 bits identify the network and the last 8 bits identify individual hosts. Understanding binary subnet calculations is essential for network design and troubleshooting. Data integrity during transmission is verified using binary-based techniques like parity bits, checksums, and cyclic redundancy checks (CRC), which detect transmission errors by performing mathematical operations on the binary data stream.
Binary arithmetic remains foundational to modern computing, networking, and digital communication. IP addressing uses binary operations extensively — a subnet mask like 255.255.255.0 is the binary number 11111111.11111111.11111111.00000000, and performing a bitwise AND between an IP address and its subnet mask determines the network address. Network engineers use binary calculations daily for subnetting, CIDR notation, and access control list configurations. In programming, bitwise operations (AND, OR, XOR, NOT, shifts) are used for performance-critical code, flag management, permissions systems, and data compression. Graphics programming uses binary extensively — color values in 24-bit RGB are three 8-bit binary numbers (0-255 per channel), and alpha compositing for transparency adds a fourth channel. Understanding binary is also essential for debugging hardware interfaces, interpreting memory dumps, analyzing network packet captures, and working with embedded systems where every bit of memory matters.
See also: Hex Calculator · Number Base Converter · Scientific Calculator
→ Understand binary place values. Each binary digit (bit) represents a power of 2: ...128, 64, 32, 16, 8, 4, 2, 1. The binary number 1010 = 8 + 0 + 2 + 0 = 10 in decimal.
→ Use hex as binary shorthand. Each hex digit maps to exactly 4 binary digits: 0=0000, F=1111, A=1010. 0xFF = 11111111 = 255. Programmers use hex because it's compact and directly translates to binary.
→ Bitwise operations are fundamental in programming. AND (&) masks bits, OR (|) sets bits, XOR (^) toggles bits, NOT (~) inverts. Bit shifts (<<, >>) multiply or divide by powers of 2 — faster than multiplication.
→ Know byte boundaries. 8 bits = 1 byte (0–255). 16 bits = 2 bytes (0–65,535). 32 bits = 4 bytes (0–4.29 billion). Understanding these limits prevents integer overflow bugs. See our Scientific Calculator for other number operations.
See also: Scientific Calculator · Hex Converter · Percentage Calculator · Average Calculator