Free Binary Calculator
Convert between binary, octal, decimal, and hexadecimal. Perform bitwise operations: AND, OR, XOR, NAND, NOR, NOT, and left/right bit shifts. Free, private — all calculations run in your browser.
How Number Systems Work
- Binary (Base 2): Only 0 and 1. Each position is a power of 2. 8 bits = 1 byte = values 0–255.
- Octal (Base 8): Digits 0–7. Each octal digit = exactly 3 binary bits. Common in Unix file permissions (chmod 755).
- Hexadecimal (Base 16): Digits 0–9 and A–F. Each hex digit = 4 binary bits (nibble). Used for memory addresses, RGB colors.
- Two's Complement: To negate a binary number, flip all bits then add 1. This is how CPUs represent negative integers.
- Bitwise AND masks bits (extracts flags), OR sets bits, XOR toggles bits, NOT inverts. Left shift multiplies by 2ⁿ.
About This Binary Calculator
The Binary Calculator lets you convert numbers between four number bases — binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16) — and perform bitwise logical and shift operations. It is an essential tool for computer science students, software developers, hardware engineers, and anyone working with low-level programming, networking, or digital electronics.
The Formula — How Conversions Work
Binary-to-decimal conversion uses positional notation: each bit is multiplied by 2 raised to its positional power, counted from right starting at 0:
Decimal-to-binary conversion uses repeated division by 2, collecting remainders from bottom to top. The same principle applies for other bases: divide repeatedly by the target base, collect remainders.
The Binary Number System
Binary (base-2) is the fundamental language of computers. Every piece of data — text, images, video, programs — is ultimately stored and processed as sequences of 0s and 1s. These correspond to the two voltage states of transistors in a CPU: high voltage = 1, low voltage = 0. This simplicity makes digital circuits extremely reliable and scalable.
Hexadecimal (base-16) is commonly used as a shorthand for binary because every 4 binary bits correspond to exactly one hex digit (0–9, A–F). A byte (8 bits) is represented by two hex digits, which is why memory addresses, color codes (#RRGGBB), and file hashes are written in hex. Octal (base-8) maps 3 bits per digit and is used in Unix file permission notation (e.g., chmod 755).
Bitwise Operations
Bitwise operations manipulate individual bits. AND is used to clear specific bits (masking). OR is used to set specific bits. XOR is used to toggle bits or detect differences (also used in simple encryption). NOT flips all bits to produce the one's complement. Left shift (≪) multiplies by 2 per shift; right shift (≫) divides by 2 per shift — making shifts the fastest way to scale by powers of 2 in low-level code. These operations are essential in systems programming, graphics, cryptography, and embedded firmware.
Privacy Notice
All calculations in this binary calculator are performed entirely in your browser. No data you enter is transmitted to any server, stored in any database, or shared with third parties. See our Privacy Policy for full details.
When to Use This Calculator
Convert between number bases and verify bitwise operation results for CS assignments. Great for self-checking base-conversion steps before an exam.
IP addresses and subnet masks are binary under the hood. Convert IPv4 octets to binary to understand CIDR notation, subnet divisions, and network masks.
Verify flag values, bitmask operations, and register states when debugging low-level code. Check that your AND, OR, and XOR logic produces the expected bit pattern.
Design logic gates, verify truth tables, and check binary-coded decimal (BCD) representations used in digital circuits and microcontroller programming.
Understand how ASCII and Unicode characters map to binary. Inspect the binary representation of text characters for encoding troubleshooting.
💡 Pro Tips
Use hexadecimal as shorthand for binary — each hex digit maps to exactly 4 bits. For example, 0xFF = 11111111 in binary and 0xA = 1010. This makes reading and writing large binary numbers in code much faster and less error-prone than spelling out every bit.
Memorising powers of 2 up to 2¹⁰ = 1,024 is one of the highest-return memorisation tasks in computer science. Knowing that 2⁸ = 256, 2¹⁰ = 1,024, and 2¹⁶ = 65,536 lets you instantly recognize common data boundaries, memory sizes, and IP address components.
Bit shifting is the fastest way to multiply or divide by powers of 2. Shifting left by n bits multiplies by 2ⁿ; shifting right by n bits divides by 2ⁿ (integer division). This trick is widely used in performance-critical code, embedded systems, and graphics programming.
Know the difference between MSB (most significant bit) and LSB (least significant bit). The MSB carries the highest weight (leftmost in standard notation) and the LSB carries the lowest (rightmost). When debugging binary protocols and file formats, confusion about bit ordering (big-endian vs little-endian) is a frequent source of bugs.
Frequently Asked Questions
Related Calculators
Your input is processed locally in your browser and is never stored, transmitted, or shared with any server. See our Privacy Policy.