Binary Calculator
Convert numbers between binary, decimal, hexadecimal, and octal. Also converts between any number base from 2 to 36. Shows all representations simultaneously.
You might also need
How It Works
Divide by 2 repeatedly, collecting remainders. Read from bottom to top. Position values are powers of 2: 1,2,4,8,16,32,64,128...
Divide by 2, collect remainders42: 42→21R0, 21→10R1, 10→5R0, 5→2R1, 2→1R0, 1→0R1 = 101010Multiply each bit by its place value (power of 2) and sum. Rightmost bit = 2⁰=1, next=2¹=2, next=2²=4, etc.
Sum of (bit × 2^position)101010: 32+8+2=42Group binary digits in sets of 4 from the right. Convert each group to hex: 0000=0, 1111=F. Hex is a compact notation for binary.
4 binary bits = 1 hex digit1111 1111 = FF = 255Group binary in sets of 3 from right. Each group becomes an octal digit (0-7). Octal was used in older systems.
3 binary bits = 1 octal digit101 110 = 56 in octalBinary is used for bitwise operations in programming. AND: both 1 → 1. OR: either 1 → 1. XOR: different → 1.
a AND b, a OR b, a XOR b5 AND 3: 101 AND 011 = 001 = 1To negate a number: invert all bits, add 1. In 8-bit: −42 = invert(00101010)+1 = 11010101+1 = 11010110.
Negate = flip bits + 1−42 in 8-bit = 11010110Quick Reference
Common examples — verify instantly above.
Dec→Bin
42
101010
Dec→Bin
255
11111111
Bin→Dec
1010
10
Bin→Dec
11111111
255
Dec→Hex
255
FF
Hex→Dec
FF
255
Dec→Oct
8
10
Byte
11111111
255 / FF
Tips & Shortcuts
Learn the first 8 powers of 2: 1, 2, 4, 8, 16, 32, 64, 128. These are the bit values for a single byte.
A byte (8 bits) ranges from 0 to 255. Two bytes (16 bits) range from 0 to 65535.
Hex is a compact shorthand for binary: each hex digit = 4 binary bits. FF = 1111 1111.
To quickly convert small hex to binary: F=1111, A=1010, 5=0101, 0=0000.
The number of unique values in n bits = 2^n. 8 bits = 256 values, 16 bits = 65536 values.
Binary addition: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (carry the 1). Same rules as decimal but only 0 and 1.
Common Mistakes
Reading binary from left to right during conversion
When dividing by 2, read remainders bottom to top (right to left in the result).
Forgetting that the rightmost bit is 2⁰, not 2¹
The rightmost (least significant) bit represents 2⁰=1, not 2¹=2. Count from the right starting at 0.
Thinking hex requires letters A-F to be memorized
Just remember: A=10, B=11, C=12, D=13, E=14, F=15. Or use this calculator for instant conversion.
Confusing octal and binary grouping
Octal groups binary in 3s. Hex groups in 4s. Never mix the grouping sizes.
Assuming 0 in binary is the same as nothing
0 is a valid binary digit that holds a place value. 1010 ≠ 110 — the zeros matter.
Using two's complement for positive numbers
Two's complement is only for representing negative numbers. Positive numbers are standard binary.
Frequently Asked Questions
Binary is base-2 — uses only digits 0 and 1. Every position represents a power of 2: ...128, 64, 32, 16, 8, 4, 2, 1.
Divide by 2 repeatedly, recording remainders. Read remainders bottom to top. Example: 13 → 13/2=6 R1, 6/2=3 R0, 3/2=1 R1, 1/2=0 R1 → 1101.
Each hex digit represents exactly 4 binary digits. FF(hex) = 1111 1111(binary). This makes hex a compact shorthand for binary.
Electronic circuits have two states: on and off. Binary maps perfectly to these states. Logic gates perform binary arithmetic directly in hardware.
A byte is 8 bits (binary digits). It can hold values from 0 (00000000) to 255 (11111111) or FF in hex.
The standard way to represent negative integers in binary. Invert all bits and add 1. Allows hardware to use the same addition circuits for subtraction.
Two's complement is how computers store negative integers. To negate: flip all bits (one's complement) then add 1. Example: +5 in 8 bits = 00000101. Flip: 11111010. Add 1: 11111011 = −5. This system means addition and subtraction use the same hardware circuit — no separate negation logic needed. The most significant bit is the sign: 0 = positive, 1 = negative.
Related Calculators
Base64 Encoder Decoder
Encode or decode any text to and from Base64.
URL Encoder Decoder
Encode or decode URL strings for safe web transmission.
Simple Interest Calculator
Calculate interest earned on a principal without compounding.
Present Value Calculator
Find the current value of a future sum of money.
Scientific Calculator
Full scientific calculator with trig, log, and advanced functions.
Basic Calculator
Fast arithmetic: add, subtract, multiply, divide.