Bits, Bytes, and Hex
In this page we provide a review of the way information is stored and processed by computers and, by extension, the Internet and the Web. One supposes that it would be nice if all of this were transparent to the user—that the user would not need to know that under the hood all data is represented as bits and bytes. But that's just not reality. So we suck it up and learn about bits, bytes, and hexadecimal representations. But, you don't really need to suck very hard, because at when all is said and done, this is pretty easy stuff.
Bits
Bits—What They Are
Test Yourself
Q1. What are bits? Determine which of the following are correct. A bit is:
A 1 or a 0.
Reveal AnswerTrue.A digit in the binary number system.
Reveal AnswerTrue. The binary number system has two digits, 0 and 1, just as the base-10 number system we use (probably because we have 10 fingers) has 10 digits, 0 through 9.
A string of 1s and 0s.
Reveal AnswerNo. Bits are strung together to represent more than just two things. For example, there are 256 different bit strings that are 8 bits long; each of these 256 8-bit strings can be used to represent different characters used in English text. Since a single bit is either a 0 or a 1, one bit can only refer to 2 different things.
The same thing as "byte."
Reveal AnswerNo. A byte refers to a string of 8 bits.
A Bit of a Definition
We can define bit this way
Definition: In computing, the term bit stands for binary digit. In the binary number system there are only two digits, 0 and 1. Thus when the term "bit" is used it refers to a value that is either 0 or 1.
In English bit also means a small piece of something, as in a bit of bread, or a little bit of butter. In computing bit has this same connotation in the sense that a bit of information is the smallest quantity of information that can be recorded (that is, a 0 or a 1).
Bits—How They Are Used in Computing
Test Yourself
Bits in strings of a certain lengths can be used to represent:
numbers.
Reveal AnswerTrue. Whole numbers can be represented in binary as well as they can in decimal.
characters.
Reveal AnswerTrue. Standard codes have been developed for just the English alphabet (referred to as the ASCII code) as well as for all written alphabets (Unicode). In the extended ASCII code characters are represented as stings of 8 bits, which allows for 28 = 256 codes for 256 different characters. On the other hand, Unicode characters can be represented as strings of 16, which allows for 216 = 65,536 different codes for different characters, hopefully covering all of the characters in all of the written languages of the world.
All information stored in digital media or transmitted across the Internet is in the form of bits.
Reveal AnswerTrue.
Bits—Why They Are Used in Computing
Test Yourself
Bits are used to encode information used in computers because:
Bits (0s and 1s) are intrinsically more accurate than decimal digits for representing information.
Reveal AnswerNot really. There is no benefit from an accuracy perspective in choosing one number base over another for representing information.
Representing information as strings of 0s and 1s is easier for humans to comprehend than representing information as strings of decimal digits.
Reveal AnswerNot so. In fact, it is quite difficult in general for humans to recognize what a binary string represents in terms of information, because a binary string can be quite long.
Because computer engineers (the people who invented and grew computer technology) found ways to construct electronic components that can be set to be in one of two states which could represent a 0 or a 1, respectively.
Reveal AnswerThat is correct. The capacity to construct two-state devices meant that these devices could be used to represent either a 0 or a 1. Such a device is similar to a light switch in the sense that when an open switch (meaning that there is no connection to the light from the electricity source, so the light is off) could be used to represent 0, whereas a closed switch (meaning that there is a connection to the light from the electricity source, so the light is on). More importantly, computer engineers also developed circuits that could perform arithmetic on binary numbers.
Bits—Why We Need to Know About Them
Test Yourself
We need to know about bits to understand computing, the Internet, and the Web because the terminology of bits shows up in various ways. What ways can you think of?
After you have thought of some ways, check to see whether they include some the ones mentioned here.
Reveal Answer
- Internet speed connections are advertised in bits per second
- The term "byte" appears everywhere. It refers to a sequence of 8 bit. Thus, knowing about bits gives us a better understanding of the size of a byte. For example, since there are 8 bits in one byte, one byte can hold one of the 256 different (extended) ASCII characters, whereas it takes two bytes to hold a single 16-bit Unicode character.
- Digital videos are recorded in bits per second of movie.
- Did you think of others?
Applying Knowledge of Bits
Test Yourself
Having a knowledge of what a bit is helps us get a better grasp of many aspects of computing, the Web, and the Internet. Can you think of some examples?
Reveal Answer
- Since Internet speed connections are advertised in bits per second, and we know that one bit does not carry much information, this gives us the understanding that groups of bits (e.g., bytes) downloaded per second is more informative important (such as bytes of information).
- Knowing that a byte is 8 bits long, we can thus calculate how long it will take to download a file of size given in bytes
- The term "byte" appears everywhere. It refers to a sequence of 8 bit. Thus, knowing about bits gives us a better understanding of the size of a byte. For example, since there are 8 bits in one byte, one byte can hold one of the 256 different (extended) ASCII characters, whereas it takes two bytes to hold a single 16-bit Unicode character.
- Digital videos are recorded in bits per second of movie.
- Did you think of others?
Bytes
Test Yourself
What is a byte?
Reveal AnswerA byte is an 8-bit chunk of data.
How are bytes used in computing?
Reveal AnswerA byte is used to represent the smallest unit of information that can be individually accessed in a computer. A single bit generally does not hold enough information to make it useful by itself. The fact that we use chunks of 8 bits as the smallest unit of information that can be directly accessed is largely just happenstance. It possibly happened because each character of the 256 extended ASCII character set can be represented with 8 bits, so the size in bits of a character became the size of the smallest chunk of directly accessible computer memory.
Why are bytes used?
Reveal AnswerWhen various components of a computer are built, they must be able to work with some chosen smallest chunk of information. For example, random access memory (RAM) is constructed to be able to store and retrieve information with the byte as the smallest size of RAM that can be addressed. So, RAM size is advertised in the number of bytes of information it can hold. For example, 8 Gigabytes of RAM means that there are 8 billion bytes of RAM, each of which has its own address in RAM. The 8-bit byte has become the standard unit of for this purpose.
Why do we need to know about bytes?
Reveal Answer
- We encounter the term "bytes" everywhere. It is much more in the public conscience than "bits" since a byte represents the smallest section of bits (8) that is practical for representing information. Yet most people don't understand what a byte is. We encounter the term "byte" or "bytes" in such places as:
- The advertised size of RAM in a computer, smart phone, or pad.
- The advertised size of a hard drive or flash drive in a computer
- The advertised size of flash memory stick or camera card
- The size of files stored on our computer or any of the above devices
Applying our knowledge about Bytes.
Reveal Answer
- We can make better decisions about how much RAM or hard disk space we need when we consider our storage needs
- We estimate the average size in bytes of our expected number of music files, picture files, and video files and multiply those by the number of music files, picture files, and video files, respectively to estimate the size of hard disk space we will need.
- We can calculate file download time for a file given an Internet download speed in bits per second and thus adjust image sizes accordingly when constructing a Web page or sending a picture to a friend as an email attachment
- ...and many other things
What in the Hex?
What is hexadecimal?
Reveal AnswerHexadecimal refers to the digits in the base 16 number system.
What are the hexadecimal digits?
Reveal Answer0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
How is hexadecimal used?
Reveal AnswerShort answer: Hexadecimal is used to make bit strings more readable. In fact, that is its only use: to make bit strings more readable for us humans.Example: In a bit string, each four bits can be represented as a single hexadecimal digit for human consumption. For example, consider the color in the following rectangle.
When specifying this color for the Web, we usually specify it in hexadecimal, which in this case is:
F3456F
Really, in the computer, this color is given in the native bit format of a computer as:
111100110100010101101111
The first eight bits (i.e., the first byte) represent the amount of red in the color. The second eight bits (i.e., the second byte) represent the amount of green in the color, and the third eight bits (i.e., the third byte) represent the amount of blue in the color. Putting spaces between the eight bits for readability gives
11110011 01000101 01101111
That doesn't help much. Thus we make use of the fact that each four bits in a bit string can be represented with a single hexadecimal (base 16) digit, because there are 16 combinations of bit patterns of length 4, from 0000 up to 1111, where 0000 as a bit string is 0 as a hexadecimal string, and 1111 as a bit string is F as a hexadecimal string.
The correspondence for all bit strings of length 4 and their corresponding hexadecimal digits is:
00002 = 016 00012 = 116 00102 = 216 0011 = 316
01002 = 416 01012 = 516 01102 = 616 01112 = 716
10002 = 816 10012 = 916 10102 = A16 10112 = B16
11002 = C16 11012 = D16 11102 = E16 11112 = F16So, by putting another blank between each four bits of the color bit string for readability and putting the corresponding hexadecimal value below them, we get:
1111 0011 0100 0101 0110 1111
F 3 4 5 6 FThus, the original bit string for the color can be more compactly represented in hexadecimal (or just hex for short) as
F3456F
This is easier to view and read. The red component of the color is represented as F3, the green as 45, and the blue as 6F.
Why do we need to know about hexadecimal?
Reveal AnswerWe encounter hexadecimal digits quite often in computing such as in:
- Specifying Web colors
- Reading passwords on the backs of the wireless connection boxes we use to connect to the Internet from our homes.
Applying hexadecimal knowledge.
Reveal AnswerWe can be called on to:
- Create a Web color as a 6-digit hexadecimal value.
- Convert a bit string to hexadecimal string for easier readability.