Units of storage
Everything in a computer is stored as 1s and 0s. A single 1 or a single 0 in a computer is called a 'bit'. If we store a character in a computer it takes eight 1s and 0s, so we might say it takes eight bits to store a character.
Imagine you had to write a 1000 word essay. If we assume that each word has an average of five letters, we can do a rough calculation to work out how many bits it would take to store the essay.
If each letter takes eight bits to store and we have five letters in a word then each word would take forty bits to store.
If we have 1000 words then we would need to multiply 1000 by 40 which gives us 40,000 bits. We would also have to store the spaces between words (a space uses the ASCII code 32). This will of course, add more bits to this number.
The number of bits (1s and 0s) that we store in a computer adds up very quickly. Remember too that pictures and videos are stored as 1s and 0s and these take many, many bits to store. If you had a video on your computer you might look at the size of it and see that it was made up of 1,258,291,200 bits. Clearly this is a large number and so thankfully we can convert this to other units that make it easier to work with.
As already stated above, a single 1 or a single 0 in a computer is called a bit. The next unit up is called a byte and a byte is 8 bits together.
The next unit is called a kilobyte. Kilo, as in kilometre or kilogram, means 1000. Although, in computer terms, kilo means 1024, so 1 kilobyte is 1024 bytes.
The next unit up is called a megabyte. 1 megabyte is 1024 kilobytes. After that it's a gigabyte, which is 1024 megabytes. Can you see the pattern? You just take the unit before and multiply it by 1024. 1024 gigabytes are called a terabyte and 1024 terabytes are 1 petabyte. 1 petabyte is made up of 9,007,199,254,740,992 bits.
This table shows how the units are related.
Unit | Description | Example |
Bit | 1 or 0 | A single pixel in a black and white picture |
Byte | 8 bits | A single character |
Kilobyte | 1024 bytes | A small email is about 2 kilobytes |
Megabyte | 1024 kilobytes | MP3 files take up about 1 megabyte per minute |
Gigabyte | 1024 megabytes | 1 gigabyte can hold about 300 MP3 songs |
Terabyte | 1024 gigabytes | 1 terabyte can hold about 100 DVD-quality films |
Petabyte | 1024 terabytes | 1 petabyte can hold enough MP3 songs to play continuously for over 2000 years - without repeating! |
Unit | Bit |
---|---|
Description | 1 or 0 |
Example | A single pixel in a black and white picture |
Unit | Byte |
---|---|
Description | 8 bits |
Example | A single character |
Unit | Kilobyte |
---|---|
Description | 1024 bytes |
Example | A small email is about 2 kilobytes |
Unit | Megabyte |
---|---|
Description | 1024 kilobytes |
Example | MP3 files take up about 1 megabyte per minute |
Unit | Gigabyte |
---|---|
Description | 1024 megabytes |
Example | 1 gigabyte can hold about 300 MP3 songs |
Unit | Terabyte |
---|---|
Description | 1024 gigabytes |
Example | 1 terabyte can hold about 100 DVD-quality films |
Unit | Petabyte |
---|---|
Description | 1024 terabytes |
Example | 1 petabyte can hold enough MP3 songs to play continuously for over 2000 years - without repeating! |
The start of each word (before the ‘byte’) is called a prefix. We use these in everyday life too: I wouldn’t give my car's weight in grams, though I technically could. I would add the ‘kilo’ prefix to describe the weight in Kilograms, which would be more sensible.
In Computing Science, we use prefixes to stop us having to write down enormous numbers – a Terabyte is in reality 1125899906842624 bytes!