Home

What Is Binary Code and How Does It Work?

Learn about the binary numbering system

First invented by Gottfried Leibniz in the 17th century, the binary number system became widely used when computers demanded a way to represent numbers using mechanical keys.

What is binary code?

Binary is a 2-based number system that represents numbers using a pattern of ones and zeros.

Early computer systems had mechanical switches that opened to represent 1 and closed to represent 0. By using keys in series, computers could represent numbers using binary code. Modern computers still use binary code in the form of digital ones and zeros in the CPU and RAM.

A numeric one or zero is a simple electrical signal that turns on and off inside a hardware device such as a CPU that can store and calculate millions of binary numbers.

Binary numbers consist of a string of eight “bits” known as “bytes”. A bit is an odd or zero that makes up an 8-bit binary number. Using ASCII codes, binary numbers can also be converted to text characters to store information in the computer’s memory.

geralt/pixabay

How do binary numbers work?

Converting a binary number to a decimal is very simple when you consider that computers use the base 2 binary system. The location of each binary digit determines its decimal value. For an 8-bit binary number, the values ​​are calculated as follows:

  • 1st bit: 2 to the 0 = 1
  • 2nd bit: 2 increased to 1 = 2
  • 3rd bit: 2 to the 2 = 4
  • 4th bit: 2 to the 3 = 8
  • 5th bit: 2 to the 4 = 16
  • 6th bit: 2 to the 5th = 32
  • 7th bit: 2 to the 6 = 64
  • bit 8: 2 to the 7 = 128

You can represent any decimal number from 0 to 255 by adding individual values ​​where the bit is one. By adding more bits to the system, much larger numbers can be represented.

When computers had 16-bit operating systems, the largest odd number the CPU could calculate was 65,535. 32-bit operating systems can handle individual decimal numbers up to 2,147,483,647. Modern computer systems with 64-bit architecture are capable of working with impressively large decimals up to 9,223,372,036,854,775.807!

Representing information with ASCII

Now that you understand how a computer can use the binary number system to work with decimals, you may wonder how computers use it to store text information.

This is done thanks to something called ASCII code.

The ASCII table consists of 128 text or special characters, each with an associated decimal value. All ASCII-compliant applications (such as word processors) can read or store text information to and from the computer’s memory.

Some examples of binary numbers converted to ASCII text include:

  • 11011 = 27 which is the ESC key in ASCII
  • 110000 = 48 with 0 in ASCII
  • 1000001 = 65 which is A in ASCII
  • 1111111 = 127 which is the DEL key in ASCII

The base 2 binary codes are used by computers for text information, while other binary math formats are used for other data types. For example, base64 is used to transfer and store media such as images or videos.

Binary code and storage information

Every document you write, web pages you view, and even video games you play is made possible by the binary numbering system.

Binary code allows computers to process and store any information that goes to and from the computer’s memory. Everything with a computer, even the computers in your car or your cell phone, uses binary numbering for everything you use.

Knowing how to read binary files will help you better understand computers.


See more

What Is Binary Code and How Does It Work?

Learn about the binary number system

First invented by Gottfried Leibniz in the 17th century, the binary number system became widely used once computers required a way to represent numbers using mechanical switches.

What Is Binary Code?

Binary is a base-2 number system representing numbers using a pattern of ones and zeroes.

Early computer systems had mechanical switches that turned on to represent 1, and turned off to represent 0. By using switches in series, computers could represent numbers using binary code. Modern computers still use binary code in the form of digital ones and zeroes inside the CPU and RAM.

A digital one or zero is simply an electrical signal that’s either turned on or turned off inside of a hardware device like a CPU, which can hold and calculate many millions of binary numbers.

Binary numbers consist of a series of eight “bits,” which are known as a “byte.” A bit is a single one or zero that makes up the 8 bit binary number. Using ASCII codes, binary numbers can also be translated into text characters for storing information in computer memory.

 geralt/pixabay
How Binary Numbers Work

Converting a binary number into a decimal number is very simple when you consider that computers use a base 2 binary system. The placement of each binary digit determines its decimal value. For an 8-bit binary number, the values are calculated as follows:

Bit 1: 2 to the power of 0 = 1
Bit 2: 2 to the power of 1 = 2
Bit 3: 2 to the power of 2 = 4
Bit 4: 2 to the power of 3 = 8
Bit 5: 2 to the power of 4 = 16
Bit 6: 2 to the power of 5 = 32
Bit 7: 2 to the power of 6 = 64
Bit 8: 2 to the power of 7 = 128

By adding together individual values where the bit has a one, you can represent any decimal number from 0 to 255. Much larger numbers can be represented by adding more bits to the system.

When computers had 16-bit operating systems, the largest individual number the CPU could calculate was 65,535. 32-bit operating systems could work with individual decimal numbers as large as 2,147,483,647. Modern computer systems with 64-bit architecture have the ability to work with decimal numbers that are impressively large, up to 9,223,372,036,854,775,807!

Representing Information With ASCII

Now that you understand how a computer can use the binary number system to work with decimal numbers, you may wonder how computers use it to store text information.

This is accomplished thanks to something called ASCII code.

The ASCII table consists of 128 text or special characters that each have an associated decimal value. All ASCII-capable applications (like word processors) can read or store text information to and from computer memory.

Some examples of binary numbers converted to ASCII text include:

11011 = 27, which is the ESC key in ASCII
110000 = 48, which is 0 in ASCII
1000001 = 65, which is A in ASCII
1111111 = 127, which is the DEL key in ASCII
While base 2 binary code is used by computers for text information, other forms of binary math are used for other data types. For example, base64 is used for transferring and storing media like images or video.
Binary Code and Storing Information

All of the documents you write, web pages you view, and even the video games you play are all made possible thanks to the binary number system.

Binary code allows computers to manipulate and store all types of information to and from computer memory. Everything computerized, even the computers inside your car or your mobile phone, make use of the binary number system for everything you use it for.

Knowing How to Read Binary Will Help You Understand Computers More

#Binary #Code #Work


Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *

Back to top button