Encoding vs Encryption vs Tokenization
1 min readThree often confused techniques: encoding is about format, encryption about confidentiality, tokenization about substitution.
Table of Contents
Comparison
| Aspect | Encoding | Encryption | Tokenization |
|---|---|---|---|
| Purpose | Data formatting for storage/transport | Confidentiality (pseudonymization) | Data substitution with non-sensitive token |
| Security | None (reversible, no key) | High (requires key) | Highest (no mathematical relationship) |
| Reversibility | Always (public algorithm) | With key only | Via token vault only |
| Use Case | Base64, JSON, URL encoding | TLS, AES-256, KMS | PCI DSS, PII replacement |
Details
Encoding
- Converts data to different representation (Base64, UTF-8, URL encoding)
- Not secure — anyone can decode
- Use for: data transport, storage formatting, API payloads
Encryption
- Transforms plaintext → ciphertext using key
- Symmetric (AES) — same key encrypt/decrypt
- Asymmetric (RSA, ECC) — public encrypt, private decrypt
- Use for: data at rest (S3, DDB), data in transit (TLS), secrets
Tokenization
- Replaces sensitive data with random token (no math relationship)
- Token maps to original in secure token vault
- Original data never leaves vault
- Use for: credit cards (PCI), SSN, PII in logs/analytics
When to Use What
| Scenario | Approach |
|---|---|
| API payload, binary → text | Encoding |
| Database encryption, file encryption | Encryption |
| Payment processing, PII in non-prod | Tokenization |
| Defense in depth | Combine: Tokenize → Encrypt vault → Encode for transport |