2’s Complement Dec-Bin Converter

A dec-bin converter uses 2’s complement. Visit my Medium Post.

What is 2’s complement?

Two’s complement is the most common method of representing signed integers on computers. Note that signed integers represent both positive and negative numbers whereas unsigned integers represent non-negative numbers (zero or positive numbers) only.

Since it expresses the negative numbers in binary form, we will use this method when converting a negative denary number to binary. The complements are as below:

  • 1’s complement inverts the binary numbers;
  • 2’s complement adds a bit (1) or a fractional bit (0.0…1) to the inverted binary numbers.

Getting Started

These instructions will get you a copy of the project on your local machine.


Downloading the Python File

Once you have installed Python, you may download the 2s_complement.py and run it on your machine.

Have fun!


Feel free to fork and give a star to my repo. 🌟

If you have a good idea or find a bug in my codes, make a pull request and raise an issue at my repo anytime!

Coming Soon

I will be creating more repos, stay tuned! 🔥


View Github