Binary Calculator

Convert binary to decimal, decimal to binary, or add two binary values.

Binary Calculator

Formula

bin2dec: parseInt(value, 2); dec2bin: n.toString(2); bin_add: sum then toString(2)

Default mode reads a binary string as base 2 and returns its decimal value. Other modes convert decimal to binary or add two binary strings.

This binary calculator converts binary to decimal, decimal to binary, or adds two binary numbers. The default mode is Binary → Decimal with value 1010, which equals 10. The optional second binary field defaults to 110 for addition mode.

Learners use it while studying place value in base 2. Developers use it for quick checks. For hex work, a dedicated hex tool is a better fit than forcing hex digits into binary fields.

How the formula works

Binary → Decimal interprets the string as base 2. Decimal → Binary writes a non-negative integer in base 2. Add mode parses both binary strings, adds their decimal values, then writes the sum back in binary.

Worked example

Value 1010, mode Binary → Decimal. Place values 8+0+2+0 = 10.

InputValue
Value1010
ConvertBinary → Decimal
Result10

How to use the fields

  • Value is the primary binary or decimal string depending on mode.
  • Convert chooses Binary → Decimal, Decimal → Binary, or Add two binaries.
  • Second binary is only required for the add mode.

Place value reminder

From the right, binary places are 1, 2, 4, 8, 16, and so on. In 1010 the bits with value 1 sit in the 8 and 2 places. Adding those places recovers decimal 10.

Common mistakes

  • Typing digits other than 0 or 1 in binary modes
  • Leaving add mode on while only meaning to convert one number
  • Expecting fractional binary support in this tool
  • Entering a negative decimal for Decimal → Binary

Addition walkthrough

1010 + 110 → 10 + 6 = 16 → binary 10000. Checking in decimal first catches bit mistakes. Then confirm the binary sum has the expected number of bits.

Homework checks

Convert a few textbook binaries both directions. If Binary → Decimal and Decimal → Binary are inverses on your examples, your bit strings are consistent. Keep the site default at 1010 so shared answers match.

Why base 2 matters

Digital systems store on/off states. Binary is the human readable form of those states for small integers. Understanding conversion makes bit masks and simple flags less mysterious even if you rarely type binary by hand at work.

Start with nibble sized examples (four bits) before long strings.

Classroom practice

Ask students to expand 1010 as 1×8 + 0×4 + 1×2 + 0×1 before using the calculator. Matching 10 proves the place value story. Then switch mode and convert 10 back to binary to close the loop.

Follow with the add mode using the default second value 110 so everyone shares the same 10000 result.

Nibble and byte landmarks

Four bits make a nibble and eight bits make a byte. Practicing with short strings like 1010 builds place value before you move to longer machine words.

When a string grows, convert in chunks and concatenate carefully, or stay inside the calculator for the whole string.

Addition carries

Binary addition carries when two 1 bits share a place. Checking the sum in decimal first, then converting back, is a reliable homework strategy and matches what the add mode does internally.

Try the defaults 1010 and 110 once on paper with carries, then confirm binary 10000.

Invalid characters

Any digit other than 0 or 1 breaks binary modes. Spaces and punctuation also fail. Paste carefully from documents that might hide formatting characters.

Decimal mode wants an ordinary non-negative integer string without binary prefixes like 0b unless you strip them first.

Homework checklist

Convert, then invert the conversion, then try one addition. That three step loop catches most place value mistakes. Keep the published default at 1010 so class answers match when everyone starts from the same screen.

When your course asks for leading zeros to a fixed width, pad by hand after the calculator returns the minimal binary digits.

Limitations

Inputs are simple unsigned strings and non-negative decimals. No fractional bits, no two’s complement display, and no bitwise AND/OR modes on this page.

For related unit and percent checks while you plan materials, try the unit converter or the percentage calculator.

Frequently Asked Questions

What does the default example show?

Binary 1010 in Binary → Decimal mode equals decimal 10.

Which characters are allowed in binary?

Only 0 and 1 digits for binary modes.

What does the second value field do?

It is used when you choose Add two binaries. Default second binary is 110.

How do I convert decimal to binary?

Choose Decimal → Binary and enter a non-negative whole number in the value field.

What is 1010 + 110 in binary?

Decimal 10 + 6 = 16, which is binary 10000.

Are negative decimals supported?

The decimal to binary path expects non-negative integers.

Is leading zero allowed?

Yes for binary strings, though it does not change the numeric value.

Does this show two’s complement?

No. It focuses on unsigned conversion and simple binary addition.