Base64
A way to write any bytes using only 64 safe text characters, so binary data can travel in places that expect text.
In more detail
Encoding is not encryption: anyone can decode Base64, so it hides nothing and needs no key. Basic authentication uses standard Base64, and JSON Web Tokens use the URL-safe variant, base64url, for their three parts.
Examples
printf '%s' "$secret" | base64base64.b64decode("c3ZjLXJlcG9ydDpub3QtYS1yZWFsLXBhc3N3b3Jk") # b'svc-report:not-a-real-password'echo -n hello | base64 # aGVsbG8=In the browser: Base64 is an encoding, not encryption: anyone can decode it.Related terms
- Basic authentication — An HTTP authentication scheme that sends a user name and password in the Authorization header, joined with a colon and Base64-encoded.
- JSON Web Token — A compact signed token made of three base64url parts separated by dots: a header, a payload of claims and a signature.
- secret masking — The runner's replacement of known secret values with asterisks in job logs.
- Kubernetes Secret — A Kubernetes object for small sensitive values such as passwords and tokens, which pods can use as files or environment variables.
- encoding — Turning data into a different representation so it can be stored or transmitted, following a public rule that anyone can reverse.
- obfuscation — Making data or code hard to read without truly protecting it, for example by encoding it in Base64 or scrambling names in a program.
- DLP — Data loss prevention: tools that watch for sensitive data leaving an organisation, such as customer records sent to a personal address.
- hash — A short fixed-length fingerprint calculated from data, which changes completely if even one byte of the data changes.
- SHA-256 — A widely used hash function that turns any data into a 256-bit fingerprint, shown as 64 hexadecimal characters.
- PKCE — Short for Proof Key for Code Exchange: the client sends a hash of a random secret at the start of the flow and the secret itself when exchanging the code.
- hexadecimal — A way of writing numbers with sixteen digits, 0 to 9 and then a to f, so each character stands for four bits.
- character encoding — The rule for turning text characters into bytes and back, such as UTF-8.
- encryption — Scrambling data with a key so only someone holding the right key can read it.
Taught in
- Basic Auth, Tokens And Sessions — Modern API Architecture: REST, GraphQL & gRPC
- JSON Web Tokens — Modern API Architecture: REST, GraphQL & gRPC
- Securing Pipelines: Secrets Management — Continuous Integration & Continuous Delivery Pipelines
- ConfigMaps And Secrets — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Workload Identity Federation: Eliminating Static Keys — Cloud Security & DevSecOps Engineering
- Zero-Trust Network Access & IdP Federation — Cloud Security & DevSecOps Engineering
- Securing the Kubernetes Control Plane & Node Components — Cloud Security & DevSecOps Engineering
- Data Loss Prevention & Egress Monitoring — Cybersecurity Fundamentals, GRC & Cryptography
- CSRF Mitigations, SameSite Cookies And Subresource Integrity — Frontend Architecture & Web Platform
- OAuth2 & OpenID Connect: Social Auth & PKCE Flows — Production Full-Stack Engineering
- ConfigMaps, Secrets And Configuration Updates — Kubernetes: Production-Grade Container Orchestration
- Buffer Encodings: UTF-8, Hex, Base64 & Slicing — Node.js Internals & Backend Services
- Native WebSockets: Bidirectional Real-Time Streams — Node.js Internals & Backend Services
- The Environment Variable Trap — Application Security & Threat Modeling for Engineers
References
- RFC 4648: The Base16, Base32, and Base64 Data Encodings
- MDN: Base64
- base64(1) manual page
- RFC 4648: the Base16, Base32, and Base64 data encodings
- Python documentation: base64