Computer Science • Data Representation

File Sizes

Everything a computer stores is bits. Pick text, an image or a sound, step through how it's stored, then work out a file size yourself.

Learning objectiveData representation · file sizes

Explain how text, images and sound are represented in binary, and calculate the size of a file from how it's stored.

  • Text: a character set gives every character a number. ASCII uses one byte per character; Unicode uses 1, 2 or 4 bytes (UTF-8, UTF-16, UTF-32). Size = characters × bytes per character.
  • Images: an image is a grid of pixels. Colour depth (bits per pixel) sets how many colours are possible: 2bits. Size = width × height × colour depth.
  • Sound: a sound wave is sampled many times a second. Sample rate and sample resolution (bit depth) set the quality. Size = sample rate × bit depth × channels × seconds.
  • Divide bits by 8 for bytes, then by 1024 for kibibytes (KiB), mebibytes (MiB) and gibibytes (GiB), or by 1000 for kB, MB and GB.

Try it yourself

File Sizes — Key Terms

Key concepts in English, with te reo Māori, Chinese (Simplified) and Korean.

EnglishTe reo Māori中文(简体)한국어What it means on this page
Bitmoka位비트A single binary digit, 0 or 1.
Bytepaita字节바이트A group of 8 bits.
Characterno attested term字符문자A letter, digit, space, punctuation mark or control code such as a line break.
Character setno attested term字符集문자 집합The characters a computer can represent, each with its own number (code).
ASCIIno attested termASCII 码아스키(ASCII)A character set of 128 characters: 7 bits each, stored in one byte.
Unicodeno attested term统一码(Unicode)유니코드A character set for every writing system, stored in 1, 2 or 4 bytes per character (UTF-8, UTF-16, UTF-32).
Pixelpika像素픽셀(화소)The smallest dot of colour in an image.
Colour depthno attested term色深색 깊이The number of bits for each pixel; 2 to the power of it is the number of colours.
Image resolutionno attested term图像分辨率이미지 해상도The number of pixels across and down, e.g. 1920 × 1080.
Alpha channelno attested termAlpha 通道알파 채널Extra bits in each pixel that store how transparent it is.
Sampleno attested term采样值샘플(표본)One measurement of the height (amplitude) of a sound wave.
Sample rateno attested term采样率샘플링 레이트(표본화율)How many samples are taken each second, in hertz (Hz).
Sample resolution (bit depth)no attested term采样精度(位深度)샘플 해상도(비트 심도)The number of bits for each sample; it sets how many levels are possible.
Kibibyte (KiB)no attested termKiB(1024 字节)키비바이트(KiB)1024 bytes. A mebibyte (MiB) is 1024 KiB, a gibibyte (GiB) 1024 MiB. A kilobyte (kB) is 1000 bytes.
File sizeno attested term文件大小파일 크기How much storage a file needs, in bits or bytes.

On the te reo Māori column. Terms marked as gaps have no attested equivalent in the sources checked — Karaitiana Taiuru's Dictionary of Māori Computer and Social Media Terms, Paekupu, the Reserve Bank's te reo financial glossary and Te Aka. No coinage is printed as though it were established; where a class needs one, commission it from Te Taura Whiri i te Reo Māori and credit the translator. Te reo Māori is not italicised and takes no plural "s".