---
# System prepended metadata

title: How do Computers store Negativ

---

# How do Computers Store Negative numbers?

## Here's an introduction, and we'll be using -11 asa a case study.

   Now, before we dive in, let's give a background study of computers and how they store positive numbers:
   I'm sure we're all familiar with bit, byte. and binary representation, as we'll be making references to them here.
   
   let's take the postive number 11 as an example:
from previous memory, we know that the binary representation of 11 is `1011`. but as simple as this looks, our computers can only store in `bytes` which are 8-bit segments. So to store the number 11, your computer uses `00001011` to make sure it completes a  `byte`.
   so, `11 = 00001011`
 
   Now, to get the computer to store -11, there are some things that we must first understand:
   
   ### Sign & Magnitude
   Sign and magnitude is a way to represent positive and negative numbers in Binary.
   Sign is represented by a single bit, using 0 to represent positive and 1 for negative. Sign can be at the beginning or the end of the number (first or last digit in a byte).
   Unsigned 8-bit ranges from 0 to 255.
   While Signed 8-bit from -127 to 127.
   
   ### One's Complement
   Take a binary representation of a positive number. The negative version of it is gotten flipping the bits (i.e changing the 1's to 0's and vice versa), and that's called the One's Complement.
   For example:
   `11 = 00001011`
   `one's complement of 11 = 11110100`
   
   ### Two's Complement
   The two's complement is used to get the binary representation of a negative number by simply signing its one's complement by adding 1 to the result.
   Example:
   One's complement of `11 = 11110100`
   then, Two's complement will be `11 = 11110101`
   
   With that in mind, let us proceed to do a Step  by Step conversion of -11 into:
   
   ### 8-bit Binary (using two's complement):
   We know that `+11 = 1011`
   But computers store in 8-bit `11 = 00001011`
   
   Using One's complement to get the negative form: `11110100` andfinally; 
   Using Two's complement to get sign we get: `11110101` by adding a 1 to sign for negativity.
   
   
   ### Hexadecimal Value
   To get the hexadecimal value of `-11 = 11110101`
   We first group it into 4 bits (nibbles).
       `1111 0101`
   Converting each nibble to its corresponding hexa decimal;
```
1111 = 15 = F
0101 = 5 
``` 
Usinfg A to F to represent the values of 10 to 15.

And as such, we get the Hexadecimal representation of -11 to be;
```
-11 = 0xF5
```
### Conclusion
To conclude, we can see that the way computers store positive and negative numbers differ and that each number entered must be stored in at least one byte, and begger number would require more than one byte to store them. In addition, we see that some Hexadecimal numbers use letters to represemnt them, and we'll talk about the importance of that in another article. Thanks for reading.