What Is Binary Code and How Does It Work?

What Is Binary Code and How Does It Work?

What Is Binary Code and How Does It Work? GA S REGULAR Menu Lifewire Tech for Humans Newsletter! Search Close GO Internet, Networking, & Security > Home Networking 69 69 people found this article helpful

What Is Binary Code and How Does It Work?

Learn about the binary number system

By Ryan Dube Ryan Dube Writer University of Maine Ryan Dube is a freelance contributor to Lifewire and former Managing Editor of MakeUseOf, senior IT Analyst, and an automation engineer. lifewire's editorial guidelines Updated on March 2, 2022 Tweet Share Email Tweet Share Email

In This Article

Expand Jump to a Section What Is Binary Code How Binary Numbers Work Binary and ASCII Code Binary Code and Storing Information 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 = 1Bit 2: 2 to the power of 1 = 2Bit 3: 2 to the power of 2 = 4Bit 4: 2 to the power of 3 = 8Bit 5: 2 to the power of 4 = 16Bit 6: 2 to the power of 5 = 32Bit 7: 2 to the power of 6 = 64Bit 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 ASCII110000 = 48, which is 0 in ASCII1000001 = 65, which is A in ASCII1111111 = 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. How to Read Binary Was this page helpful? Thanks for letting us know! Get the Latest Tech News Delivered Every Day Subscribe Tell us why! Other Not enough details Hard to understand Submit More from Lifewire How to Read Binary Task Manager (What It Is & How to Use It) What Is a Registry Value? SVG Files: What They Are and How to Open & Convert Them HQX File (What It Is and How to Open One) What's the Difference Between 32-Bit and 64-Bit? How to Round Numbers Down in Excel With the ROUNDDOWN Function What Is a Bit in Computing? What Is a Data Sanitization Method? (Data Wipe Methods) How to Use the Round Function in Excel How Are Bits Used in Digital Photography? What Is a CPU? (Central Processing Unit) How Do Bits, Bytes, Megabytes, Megabits, and Gigabits Differ? How to Use the Format Command to Write Zeros to a Hard Drive What Is a Computer File? How Base64 Encoding Works Newsletter Sign Up Newsletter Sign Up Newsletter Sign Up Newsletter Sign Up Newsletter Sign Up By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. Cookies Settings Accept All Cookies
Share:
0 comments

Comments (0)

Leave a Comment

Minimum 10 characters required

* All fields are required. Comments are moderated before appearing.

No comments yet. Be the first to comment!