Skip to content
العربية

Encoding

Base64, hex, URL-encoding and ROT13 — how data changes shape, and why that is never the same as encryption.

Track
Basics
Estimated time
18 min
Level
Beginner
Your progress in this track0%

Before this lesson

Data on the web is constantly re-shaped so it can travel safely: a password becomes Base64, a space in a URL becomes %20, bytes are written as hex. This is encoding, and the single most important thing to understand is that it is not encryption. Encoding uses a public, reversible rule with no key, so anyone can undo it.

The common encodings

examples
Base64:  SGVsbG8=            ->  Hello          (letters, digits, + / and =)
Hex:     48656c6c6f          ->  Hello          (pairs of 0-9 a-f)
URL:     %48%65%6c%6c%6f     ->  Hello          (% before each byte)
ROT13:   Uryyb               ->  Hello          (each letter shifted 13)

You learn to recognise them by their alphabet: only letters, digits and maybe a trailing = is Base64; pairs of hex digits is hex; lots of % is URL-encoding.

Review questionYou find the string SGVsbG8= in a request. Which encoding is this most likely to be?

Encoding is not encryption

Encryption needs a secret key, and without it the data cannot be read. Encoding needs no key — the rule is public — so it hides nothing from anyone who recognises it. Stacking encodings (Base64 of hex of ROT13) adds no security at all; it just adds steps to undo.

Review questionA developer stores an API key as Base64 in a config file 'so it is not in plain text'. How safe is it?

Labs

The labs for this lesson are in preparation.