The Binary Calculator converts numbers between binary, decimal, hexadecimal, and octal and performs arithmetic across all four number systems. The comprehensive number system tool for programmers, CS students, and digital electronics engineers who work across multiple bases.
38
25
13
5
4
6
38
1
38
25
13
5
4
6
38
1
A register value of 0x3F in a microcontroller datasheet means the same thing as 00111111 in binary or 63 in decimal — and fluency in converting between these representations is fundamental to embedded programming, assembly language, memory addressing, and digital circuit debugging. The binary calculator performs all conversions and arithmetic operations across all four number systems that dominate computing.
Each number base has a natural application domain in computing:
Converting between number systems:
Binary → Decimal: multiply each bit by its positional power of 2 and sum. 10110₂ = 1×16 + 0×8 + 1×4 + 1×2 + 0×1 = 22.
Decimal → Binary: repeatedly divide by 2 and record remainders (read remainders bottom-up). 22 ÷ 2 = 11 R0 → 11 ÷ 2 = 5 R1 → 5 ÷ 2 = 2 R1 → 2 ÷ 2 = 1 R0 → 1 ÷ 2 = 0 R1 → reading remainders: 10110₂.
Binary ↔ Hexadecimal: group binary digits in sets of 4 from right; convert each group to a single hex digit. 10110₂ = 0001 0110 = 16₁₆. This grouping relationship makes binary-hex conversion trivial and explains why hex is used as a compact binary representation.
Use this online calculator for any base conversion. The binary arithmetic calculator handles step-by-step arithmetic operations. The binary to decimal converter focuses specifically on base-2 to base-10 conversion.
For signed integers, the binary representation depends on the two's complement convention: the most significant bit is the sign bit (0 = positive, 1 = negative). Converting a two's complement negative binary to decimal: if the sign bit is 1, invert all bits and add 1 to get the magnitude, then negate. 11110110₂ in 8-bit signed: sign bit = 1 (negative); invert = 00001001; +1 = 00001010 = 10 decimal; result = −10. This is the representation used by all modern programming languages for signed integer types (int8_t, int16_t, int32_t, int64_t in C). The two's complement calculator and arithmetic calculators cover the complete number system toolkit.
Integer values have exact binary representations; decimal fractions generally do not. The IEEE 754 double-precision standard represents floating-point numbers as: (−1)^sign × 1.mantissa₂ × 2^(exponent−1023). The fraction 0.1 decimal = 0.000110011001100... in binary — a repeating pattern that cannot be represented exactly in finite bits. This is why 0.1 + 0.2 ≠ 0.3 in binary floating-point arithmetic — the stored approximations of 0.1 and 0.2 sum to a value slightly different from the stored approximation of 0.3. Understanding this is essential for writing correct numerical comparisons in code (never use == for floating-point equality; use abs(a−b) < epsilon).
The Result (Decimal) shows the outcome of the selected operation in base-10. For bitwise operations, the result reflects the bit-by-bit manipulation of the operands' binary representations.
Bits Needed tells you the minimum number of binary digits to represent each value. This is crucial for choosing appropriate data types in programming (e.g., 8-bit, 16-bit, 32-bit integers) and understanding memory requirements.
A result requiring more than 8 bits exceeds a single byte. More than 16 bits requires at least a 32-bit integer type. In embedded systems, selecting the wrong bit-width can cause overflow errors and data corruption.
Inputs
Results
25 (11001₂) + 13 (1101₂) = 38 (100110₂). The result requires 6 bits: ⌊log₂(38)⌋ + 1 = 6.
Inputs
Results
170 (10101010₂) XOR 85 (01010101₂) = 255 (11111111₂). XOR of complementary bit patterns produces all 1s, requiring exactly 8 bits.
How helpful was this calculator?
5.0/5 (1 rating)