What is Base64?
Learn Base64 encoding—why APIs use it, how it differs from encryption, and how to encode or decode strings locally in your browser.
Base64 turns arbitrary bytes into an ASCII-safe string using 64 characters. It shows up in email attachments, data URLs, HTTP basic auth, and JWT segments. The important mental model: Base64 is encoding, not encryption. Anyone who sees the text can decode it back to the original bytes.
Why systems use Base64
Some protocols prefer text. Binary blobs break in places that expect printable characters. Base64 expands data by about one third, which is usually acceptable for tokens and small binaries. URL-safe variants replace + and / so tokens survive in query strings.
Base64 vs other representations
- Hex doubles size but is easier to skim for byte dumps and hashes.
- Base64 is denser and dominates JWT and MIME use cases.
- Hashing (SHA-256, etc.) is one-way; Base64 is reversible.
See Base64 vs Hex Encoding for a side-by-side table.
Practical tips
- Decode before you try to pretty-print nested JSON.
- Watch for missing padding (
=) when systems strip it. - Use the URL-safe alphabet when a token lives in a URL.
- Never assume Base64 hides secrets—treat decoded output as sensitive if the source was.
Practice on ToolHub
Use Base64 Encode/Decode to round-trip strings locally. When a JWT appears as three Base64url segments, continue with JWT Decoder. For digest workflows that often sit beside encoding, try Hash Generator.
Related learning
JSON payloads are frequently Base64-wrapped in transit—read What is JSON? next. For token-shaped data, continue with What is JWT?.
Try related tools
Keep exploring
- learnWhat is JSON?Learn what JSON is, why APIs use it, common syntax rules, and which ToolHub utilities help you format and validate payloads locally.
- learnWhat is JWT?Understand JSON Web Tokens—header, payload, signature—and how to inspect claims locally without treating decoding as verification.
- collectionJSON ToolkitFormat, validate, minify, and convert JSON locally—ideal for API debugging and config work.
- collectionDeveloper EssentialsEncoding, hashing, regex, UUIDs, JWT inspection, and other daily browser utilities for engineers.
- collectionSecurity HelpersInspect JWTs, generate hashes and passwords, and encode payloads locally before they leave your machine.
- compareBase64 vs Hex EncodingBinary-to-text encodings compared—size, readability, and common API use cases.
- compareASCII vs UnicodeA 128-character legacy set versus the universal character standard—compare coverage, encoding size, and pitfalls.