Two Complement Calculator
Two's Complement Calculator works out Result in the target base and Decimal value from Number, Word width and Uppercase digits. The default figures on this page give result in the target base of -101010; change any entry and the result, the working and the sources update together.
Your figures
Updates as you typeHow this is worked out
2 steps
- "-42" read in base 10 is -42 in decimal.
- -42 in base 2 is -101010.
Its 5 worked examples are re-run on every release, last on 15 September 2026. What changed
Sources and references
3 sources
What the Two's Complement Calculator calculates
Converts whole numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36, and performs binary arithmetic and bitwise operations with two's complement fixed-width results.
How to use this Two's Complement Calculator
Enter Number, Word width and Uppercase digits. Result in the target base updates as you type. Change one figure at a time to see what drives the result.
How the result is worked out
Open “How this is worked out” beside the result for the step-by-step calculation behind Result in the target base, Decimal value and Binary.
The method follows Donald E. Knuth, The Art of Computer Programming, Volume 2: Seminumerical Algorithms, section 4.1 (Positional Number Systems), IEEE Std 754 / ISO/IEC 9899 (C) section 6.2.6.2 - integer representations and ECMA-262, ECMAScript Language Specification - BigInt.asUintN / BigInt.asIntN.
What you can compare
Change one input at a time to see how it affects Result in the target base, Decimal value and Binary. The inputs you can vary are Number, Word width and Uppercase digits.
Results are general information, not financial, tax, legal, medical or engineering advice. Check any decision that matters with a qualified professional.
See something wrong? Report a problem with this calculator
Frequently asked questions
How to calculate 2nd complement?
Converts whole numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36, and performs binary arithmetic and bitwise operations with two's complement fixed-width results. Open “How this is worked out” beside the result to see each step for your own figures.
What is 11111111 in two's complement?
Converts whole numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36, and performs binary arithmetic and bitwise operations with two's complement fixed-width results. On this page it is computed from Number, Word width and Uppercase digits and shown as Result in the target base, Decimal value and Binary.
What is the 2s complement of 7?
On the figures this page opens with, the result in the target base is -101010. No single number fits everyone: it follows Number, Word width and Uppercase digits, so enter your own above and the answer updates as you type.
What is the 2's complement of 1100?
It needs Number, Word width and Uppercase digits. Nothing else is required, and the figures stay in your browser.
What information do I need for the Two's Complement Calculator?
You need Number, Word width and Uppercase digits. The page opens with default figures that give result in the target base of -101010, so you can see the scale before entering your own.
What does this Two's Complement Calculator show?
It shows Result in the target base, Decimal value, Binary, Octal, Hexadecimal, Decimal value (numeric), Bits needed (magnitude) and Two's complement pattern, with the working and any warnings for your entries.
