Binary

Print

Binary is a base-2 numeral system that makes use of two digits, 0 and 1. It is the fundamental numbering system used by Computers and digital electronics because of how it can represent information in the form of electric signals.

How binary works.

  • It uses two digits, 0 and 1 and each digit is called a bit.
  • It can be used to count the same way decimal numbers are counted
    • When counting from, you increase the value by 1 like usual
    • When you reach 1 you carry over to the next place value just like in decimal.
    • Examples 0, 1, 10, 11, 100, 101, 110, 111 and so on.
  • Each bit has a place value that is a power of 2 from right to left. 
  • That means the right-most bit is 2⁰, 2¹, 2² and so on.

Conversions

The binary numbering system can be converted into other number systems if needed. For example, binary numbers are converted to decimal (base 10) and hexadecimal (base 16) numbers in computer networks to make up IP Addresses

  • Binary to decimal
    • Add up the values of each bit in relation to their place values
    •  Example, ( 1*2³)  + (1*2² ) + (0*2¹) + (0*2⁰) = 12
1100Total
2² 2⁰12
Example binary to decimal
  • Binary to hexadecimal and vice versa
    • The binary digits are grouped in sets of 4 starting from the right( least significant bit) and then padded with 0s if the digits are not enough to make a group of 4,
    • The groups are converted into their equivalent hexadecimal number using the table below
BinaryHexadecimalDecimal
000000
000111
001022
001133
010044
010155
011066
011177
100088
100199
1010A10
1011B11
1100C12
1101D13
1110E14
1111F15
Binary to hexadecimal to decimal guide table

  • Example, 10111011010110 to hex,  group  binary number in 4s→ 0010 1110 1101 0110
    • 0011 →3
    • 1110 →E
    • 1101 →D
    • 0110 →6
  • Therefore 10111011010110 to hexadecimal → 3ED6
  • Hexadecimal to binary  uses the same table
  • Example AD13 to binary
    • A → 1010
    • D →1101
    • 1 → 0001
    • 3 → 0011
    • AD13 → 1010110100010011
  • Take note of the zeros used for padding
  • Decimal to binary
    •  Repeatedly divided the number by 2 while keeping track of the remainder
    • The remainder will always be either 0 or 1
    • Write down  the remainder starting from the right and going to the left or reverse the order of the remainders to get the binary representation.
    • Example, to convert 12 to binary
      • 12 ÷ 2 = 6 remainder 0
      • 6 ÷ 2 = 3 remainder 0
      • 3 ÷ 2 = 1 remainder 1
      • 1 ÷ 2 = 0 remainder 1
      • The binary representation will be  → 1100 

Binary use

Understanding binary helps with learning computer science and coding because it provides insights into how computers work at their most basic level.

  • Binary is used to represent everything in computers
  • Computers break everything down into 1s and 0s  to execute complex tasks
  • Example binary bits can be manipulated to make logical operations (AND, OR, NOT)
  • Computers break down IP addresses into binary when routing traffic.

How can we help?