Skip to content
Design Corner Knowledge Base ← Back to designcorner.co.ke
Knowledge Base

Software and Development

Magic Number

Also known as: magic numbers

1 min read Updated November 10, 2026

Definition A fixed number used in code or at the start of a file to identify its type or purpose.

What it is

Many file types begin with specific bytes that tell programs what they are, for example PDF files begin with %PDF. In code, an unexplained number is also called a magic number and is bad practice.

Why it matters for your business

It helps programs recognise files correctly and warns developers about unclear code.

Real-world example

A tool recognises a renamed file as a PDF because of its first bytes.

Design Corner tip

Ask developers to replace unexplained numbers in code with named settings.

Learn more in these guides