Tools / Binary Calculator

Binary Calculator

This takes binary strings and runs arithmetic operations on it then returns in whatever base you need. This was used in Binhexa.

Operation

Expression

101100 + 110

0010 1100 + 0110

Result

Binary

0011 0010

Octal

62

Decimal

50

Hexadecimal

32

How it works

Binary arithmetic follows the same positional rules as decimal arithmetic, except the only digits are 0 and 1. Addition carries when a column sum reaches 2 (binary 10), and multiplication is simply a series of additions. Most CPUs perform all of this in hardware using logic gates built from AND, OR, XOR, and NOT operations.

The bitwise operations- AND, OR, XOR, and NOT -- work on individual bit pairs rather than the number as a whole. AND produces a 1 only when both bits are 1, making it useful for masking (isolating specific bits). OR produces a 1 when either bit is 1, useful for setting bits. XOR produces a 1 only when the bits differ, making it central to encryption and checksum algorithms. NOT flips every bit, producing the one's complement.

In CTF challenges, binary arithmetic appears most often in reverse engineering and cryptography. Assembly code uses bitwise AND with a mask like 0xFF to extract the lowest byte from a register, and uses OR or XOR to combine or obfuscate values. Recognizing these patterns in disassembly is a core low-level skill.

When solving a challenge that gives you a binary value and asks for the hex or decimal equivalent, paste the binary string here, select the appropriate operation (or just use the identity), and read off the result in the base you need. This is faster and less error-prone than manual conversion under time pressure.