ASCII codes for digits, spaces and punctuation
The text character '5' has ASCII code 53, not 5. Digits '0' to '9' are codes 48 to 57 and a space is 32, so a typed number is stored as text.
Understanding ASCII codes for digits, spaces and punctuation in ACARA Digital Technologies Years 7–8
What it does: The digits start at 48 for '0' and count up one at a time to 57 for '9'. Typing 42 stores two characters: '4' (code 52) and '2' (code 50). They are text codes, not the number 42. A space is a real character and has code 32. It is not stored as nothing or zero. Code 0 is a special control code, not the digit. The digit character '0' starts the digit codes at 48. The space counts as a character. The codes are 65, 32 and 49. The digits count up from 48, so '9' is 48 + 9 = 57.
Common mistakes: The code for '7' is 55. To get the number 7 you subtract 48, the code for '0', not 32, which is the code for a space. A space is a character with ASCII code 32, so the check must be ord(b) == 32. Code 0 is not a space.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 128–152) and word search (Modules 69–152).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
'5' = 53Fill in the Blanks
Spot the Error
Student with a class code? Join your class →