AlbaCode

ASCII

Learn how computers use binary to store text.

Introduction

As everything within a computer must be represented using binary, we need a system to represent text.

One system we can use is ASCII (American Standard Code for Information Interchange).

In ASCII each character (letters, numbers, symbols, etc.) is given its own unique binary number.

Extended ASCII is the version that we will be discussing and this uses an 8-bit number to represent each character.

This gives us a total of 256 different characters that we can represent.

For example,

CharacterCodeBinary
A6501000001
B6601000010
C6701000011

The ASCII message 01000011 01000001 01000010 would represent the word CAB

Character sets

The entire set of characters that the computer can represent is known as the character set.

The extended ASCII character set contains 256 characters.

Every character set is made up of:

Printable Characters

Printable characters include letters, numbers and symbols. You can think of these as characters that would use ink if you were to print out a document.

For example:

A, B, C, 1, 2, 3, @, $, %

Non-Printable Characters

Non-printable characters are characters that you cannot directly see but have a visible effect on the page. You can think of these as characters that would change the layout of the page but would not use ink if the document were printed.

For example:

SPACE, TAB

Control Characters

Control characters are used to perform actions rather than to display a printable character on screen.

For example:

ESCAPE, BACKSPACE, DELETE

File Size

We can easily calculate the size of a file stored using ASCII.

Every character within the file will use exactly 8 bits.

For Example:

Calculate the number of bits required to store the following text.

Hello, I am James.

First, we need to calculate the number of characters in the text.

Remember, characters include letters, numbers and symbols. This also includes spaces!

The text contains 18 characters.

Next, we need to calculate the number of bits required to store each character.

Each character requires 8 bits, so we will multiply the number of characters by 8.

18 x 8 = 144

Therefore:

The text will require 144 bits to store.