Computing

Binary Calculator & Converter

Convert and compute across binary, octal, decimal, and hexadecimal number systems.

Number systems

Converted values

Binary11111111
Octal377
Decimal255
HexFF

What is the Binary Calculator & Converter?

Number systems are the foundation of digital computing. While humans typically count in base 10 (decimal), computers operate internally in base 2 (binary), using only the digits 0 and 1 to represent all data. Each binary digit, or bit, corresponds to a power of two, and a string of bits encodes integers, floating-point values, characters, and machine instructions. Understanding binary and its related bases—octal (base 8) and hexadecimal (base 16)—is essential for computer science, digital electronics, and low-level programming.

Binary arithmetic follows the same positional notation as decimal: the rightmost digit is the ones place (2⁰), the next is twos (2¹), then fours (2²), and so on. Converting from binary to decimal requires summing each bit multiplied by its place value. For example, the binary number 1101 equals 1×8 + 1×4 + 0×2 + 1×1 = 13 in decimal. The reverse conversion—decimal to binary—uses repeated division by 2, recording remainders from bottom to top.

Hexadecimal serves as a compact human-readable shorthand for binary. Each hex digit represents exactly four bits (a nibble), so the byte 11111111 becomes FF in hex. Memory addresses, color codes, and file format specifications routinely use hex notation. Octal, though less common today, appears in Unix file permissions (chmod 755) and legacy systems. Fluency in converting among decimal, binary, octal, and hex is a core skill in introductory computer organization courses.

Binary addition and subtraction follow carry and borrow rules analogous to decimal, except carries occur when the sum reaches 2 rather than 10. Bitwise operations—AND, OR, XOR, NOT, and shifts—manipulate individual bits and underpin encryption, checksums, graphics masking, and embedded systems programming. Two's complement representation allows signed integers in fixed-width registers, with the most significant bit indicating sign.

The Binary Calculator and Converter on Online Science Tools converts numbers among binary, octal, decimal, and hexadecimal bases and performs arithmetic in any of these systems. Use it during homework to verify hand conversions and cross-check place-value expansions before implementing logic in code. Pair it with the Hex Color Picker and Converter when working with color values expressed as hex triplets.

  • Binary (base 2): digits 0 and 1; each place value is a power of 2
  • Octal (base 8): digits 0–7; each octal digit maps to 3 bits
  • Hexadecimal (base 16): digits 0–9 and A–F; each hex digit maps to 4 bits
  • Two's complement encodes signed integers in fixed bit-width registers

Mathematical / chemical formulas

Positional notation expresses a number as a sum of digit–place-value products. Conversion between bases uses division, multiplication, and grouping rules.

Positional value (base b):
  N = dₙbⁿ + dₙ₋₁bⁿ⁻¹ + … + d₁b¹ + d₀b⁰

Binary to decimal:
  (dₙdₙ₋₁…d₁d₀)₂ = Σ dᵢ × 2ⁱ

Decimal to binary (repeated division):
  Divide N by 2; record remainder (0 or 1)
  Repeat with quotient until quotient = 0
  Read remainders bottom to top

Decimal to hex:
  Divide N by 16; record remainder (0–15 → 0–F)
  Repeat until quotient = 0

Binary ↔ hex (grouping):
  Group binary in sets of 4 bits from the right
  1010 1101₂ = AD₁₆

Two's complement (n-bit):
  Positive: standard binary
  Negative −X: invert bits of |X|, then add 1
  • Leading zeros in binary do not change the value but affect fixed-width representations.
  • Overflow occurs when a result exceeds the maximum value for the given bit width.
  • Hexadecimal is preferred over octal for byte-level display because 8 = 2³ and 16 = 2⁴ align cleanly with byte boundaries.

Step-by-step example: Converting Between Decimal, Binary, and Hexadecimal

Convert the decimal number 218 to binary and hexadecimal. Verify each result by converting back to decimal.

  1. Decimal to binary: 218 ÷ 2 = 109 remainder 0; 109 ÷ 2 = 54 r 1; 54 ÷ 2 = 27 r 0; 27 ÷ 2 = 13 r 1; 13 ÷ 2 = 6 r 1; 6 ÷ 2 = 3 r 0; 3 ÷ 2 = 1 r 1; 1 ÷ 2 = 0 r 1.
  2. Reading remainders bottom to top: 218₁₀ = 11011010₂.
  3. Verify binary to decimal: 128 + 64 + 0 + 16 + 8 + 0 + 2 + 0 = 218 ✓.
  4. Decimal to hex: 218 ÷ 16 = 13 remainder 10 (A); 13 ÷ 16 = 0 remainder 13 (D).
  5. Result: 218₁₀ = DA₁₆.
  6. Verify via binary grouping: 1101 1010₂ = D (1101 = 13) A (1010 = 10), confirming DA₁₆.
  7. Verify hex to decimal: 13×16 + 10 = 208 + 10 = 218 ✓.

Enter 218 in the Binary Calculator and Converter on Online Science Tools and select decimal as the input base. The tool should display 11011010 in binary and DA in hexadecimal. Switch the input to binary, enter 11011010, and confirm the decimal output reads 218. When working with web colors like #DA7422, use the Hex Color Picker and Converter to interpret the hex components as RGB channels.

Frequently asked questions

Why do computers use binary instead of decimal?

Electronic circuits naturally represent two stable states—on and off, high voltage and low voltage—which map directly to the digits 1 and 0. Building reliable circuits that distinguish ten distinct voltage levels (for decimal) is far more difficult and error-prone. Binary logic gates (AND, OR, NOT) are simple to manufacture at scale, and all higher-level data is encoded as patterns of bits.

What is two's complement and why does it matter?

Two's complement is the standard method for representing signed integers in binary. The most significant bit indicates sign: 0 for non-negative, 1 for negative. To negate a number, invert all bits and add one. This representation allows addition and subtraction using the same hardware circuit. For an 8-bit register, the range is −128 to +127. Our Binary Calculator currently shows negatives with a leading minus in place-value form (for example −5 as −101), which is fine for homework conversions; fixed-width two's complement bit patterns are a separate hardware topic.

How is hexadecimal related to binary?

Each hexadecimal digit represents exactly four binary digits. This makes hex a compact notation for long bit strings. A 32-bit memory address written in binary would be 32 characters long; in hex it is only 8 characters. When debugging or reading datasheets, you will frequently convert between binary and hex by grouping bits in fours and mapping each group to one hex digit.

When would I use octal instead of hexadecimal?

Octal groups bits in threes rather than fours. It was common on early minicomputers whose word sizes were multiples of 3 bits (12, 24, 36). Today, octal survives mainly in Unix file permissions (rwxrwxrwx encoded as three octal digits) and some legacy protocols. For most modern computing tasks—memory addresses, color codes, assembly language—hexadecimal is preferred, but the Binary Calculator converts all four bases for completeness.

Keep learning with more calculators and study guides on Online Science Tools.

Practice problems & worked examples

Practice alongside the binary calculator above. Each problem includes a full worked solution so you can check your reasoning step by step.

Practice problem 1

Binary to decimal

Convert 1101₂ to decimal.

Show solution

Worked solution

  1. 1·8 + 1·4 + 0·2 + 1·1 = 13.

Answer: 13₁₀

Practice problem 2

Hex and binary

Convert A3₁₆ to binary.

Show solution

Worked solution

  1. A₁₆ = 1010₂, 3₁₆ = 0011₂.
  2. A3₁₆ = 10100011₂.

Answer: 10100011₂

Practice problem 3

Binary addition

Compute 1011₂ + 110₂.

Show solution

Worked solution

  1. Align: 1011 + 0110.
  2. Sum = 10001₂ = 17₁₀.

Answer: 10001₂

Related tools