Base64 Encoder / Decoder — Convert Base64 Online
Encode and decode Base64 strings instantly online. Free Base64 encoder and decoder tool. Convert text to Base64 or Base64 to text. No signup. Works in browser.
Use Base64 Encoder
Launch the Base64 Encoder tool — fully free, no signup required.
What Is Base64 Encoding?
How to Encode Text to Base64
How to Decode Base64 to Text
Common Uses for Base64 Encoding
What It Is
Base64 is a binary-to-text encoding that represents arbitrary bytes using only 64 printable ASCII characters (A–Z, a–z, 0–9, plus + / =). It exists because many internet protocols — email (SMTP), HTTP headers, JSON, XML, URLs, and config files — were designed for text and choke on raw binary. Encoding bytes to Base64 makes them safe to embed anywhere text travels: a PNG thumbnail in a CSS data URI, a TLS certificate in a PEM file, a JWT signature in a header, a username:password pair in an HTTP Basic Auth header, or a binary attachment in a MIME email. The DigiMetrics Base64 tool encodes and decodes in your browser — your input never leaves your tab.
How It Works
Base64 takes input three bytes (24 bits) at a time and re-groups them into four 6-bit chunks. Each 6-bit value (0–63) maps to a single character in the Base64 alphabet. If the input length isn't a multiple of three, the encoder pads the final group with one or two = characters so decoders know how much real data is in the last quartet. Decoding reverses the process: strip the padding, look up each character's 6-bit value, and reassemble 24-bit groups back into 8-bit bytes. The 33% size overhead (4 chars per 3 bytes) is the price of staying in the printable-ASCII range.
Real-World Examples
An API consumer encodes 'user:pass' to get the value for an HTTP Authorization: Basic header. A frontend developer embeds a 4 KB SVG icon as a base64 data URI so the page renders without a separate HTTP request. A backend engineer decodes the payload of a JWT to inspect its claims (header, payload, and signature are all Base64URL-encoded). A DevOps engineer pastes a kubeconfig secret value to decode it and check which cluster credentials are inside. A security researcher decodes a suspicious string from a phishing email and finds an obfuscated PowerShell command.
Common Mistakes to Avoid
Treating Base64 as encryption — it isn't. Anything you encode is trivially decoded by anyone who sees the string; it's encoding, not security. Confusing standard Base64 with Base64URL (the JWT variant), which swaps + for - and / for _ and drops padding. Forgetting to UTF-8 encode multi-byte characters before Base64 encoding, which corrupts emoji and non-Latin scripts. Pasting Base64 with embedded whitespace or line breaks and assuming the decoder will handle it (most do, but some strict parsers don't). And encoding huge files in the browser — Base64 was designed for kilobyte payloads, not gigabyte uploads.
Security Implications
Base64 is reversible plain text. If you see credentials, tokens, or PII Base64-encoded in a request body or cookie, treat them as fully exposed. Never store passwords Base64-encoded — use bcrypt, scrypt, or argon2. Never use Base64 as a 'tamper-proof' format; signed tokens (JWT, PASETO) exist precisely because Base64 alone offers zero integrity. On the defensive side, attackers love Base64 for obfuscating payloads in phishing macros, exfil traffic, and webshells. A spike in suspicious Base64 strings in your access logs is a red flag worth investigating.
Best Practices
Pick the right variant: standard Base64 for general purposes, Base64URL for anything inside a URL or JWT. Strip whitespace before decoding when you control the source. For binary data embedded in JSON, Base64 is the industry default — don't invent something custom. For embedding images in HTML/CSS, prefer real image URLs over data URIs once the asset is larger than ~1 KB; data URIs bloat the parent document and skip the browser cache. And always round-trip (encode then decode) when adding Base64 to a pipeline for the first time, to confirm character-set assumptions.
Troubleshooting Guide
Decoded output looks like garbage? Your input is probably Base64URL while the decoder expects standard Base64 — replace - with + and _ with /, then add = padding until the length is a multiple of 4. Decoder throws 'invalid character'? There's whitespace, a quote, or a stray newline mid-string; strip non-alphabet characters first. Encoded output works in one language but breaks in another? You hit the byte-order mark or UTF-16 vs UTF-8 mismatch; normalize to UTF-8 before encoding. Padding errors? Standard Base64 requires the output length to be a multiple of 4, padded with = if needed.
Frequently Asked Questions
What is Base64 encoding?+
Base64 encoding converts binary data into a text format using 64 printable ASCII characters. It is used to transmit data in emails, embed images in HTML and CSS, and pass data through APIs.
Is Base64 a form of encryption?+
No. Base64 is not encryption. It simply converts data into a different format. Anyone can decode it without a key. Never use Base64 to secure sensitive information.
Is Base64 encryption?+
No. Base64 is encoding, not encryption. Anyone can decode a Base64 string in milliseconds. Use it for transport safety, never for secrecy.
Why is Base64 output 33% larger?+
Base64 represents every 3 bytes with 4 characters, an inherent 4/3 = 33% overhead. That's the cost of using only 64 printable characters instead of all 256 byte values.
What's the difference between Base64 and Base64URL?+
Base64URL replaces + with - and / with _, and usually drops the = padding. It's safe to put inside URLs, filenames, and JWT segments without further escaping.
Can I Base64-encode an entire file?+
Yes, but the file must fit in browser memory. For files over ~50 MB use a streaming encoder in code rather than an online tool.
Does my data leave the browser?+
No. The encoder uses the browser's built-in btoa, atob, and TextEncoder APIs. Everything happens locally in your tab.
Why does atob fail on non-ASCII characters?+
btoa and atob only handle Latin-1. To Base64 encode UTF-8 strings (emoji, Cyrillic, CJK), encode to bytes with TextEncoder first, then Base64 the bytes.
How do I decode a JWT's payload?+
Split the token on dots, take the middle segment, replace - with + and _ with /, add = padding, and Base64 decode. The result is JSON.
Is Base64 the same as Base32 or Base58?+
No. They're different alphabets used in different contexts — Base32 in TOTP secrets, Base58 in Bitcoin addresses. Base64 is the most common.
Can I store passwords in Base64?+
Never. Use a password hashing algorithm like bcrypt, scrypt, or argon2. Base64-stored passwords are equivalent to plain text.
Why do some Base64 strings end in = or ==?+
Padding. = is added so the encoded length is always a multiple of 4 characters, which tells the decoder how many bytes of real data were in the final group.
Can I use Base64 in a CSS data URI?+
Yes — url('data:image/png;base64,...') embeds the encoded bytes directly. Best for tiny icons; larger assets are better served as separate cacheable files.
Is Base64 deterministic?+
Yes. The same input bytes always produce the same Base64 output, byte-for-byte. That makes it safe for cache keys, signatures, and content hashes.
How to encode or decode Base64
- 1
Choose direction
Pick Encode to convert plain text or binary into Base64, or Decode to reverse a Base64 string back to its original form.
- 2
Paste your input
Drop the string into the input box. The tool handles UTF-8 text, ASCII, and short binary payloads without truncation.
- 3
Run the conversion
Click Encode or Decode. The result appears instantly and stays in your browser — no server round-trip.
- 4
Copy the output
Use the copy button to drop the Base64 into a Basic Auth header, a data URI, an environment variable, or a JSON payload.
- 5
Verify if needed
Decode the result back to the original to confirm a clean round-trip. Base64 is lossless when the input is valid UTF-8 or true binary.
Learn More — Related Guides
Related Tools — More Developer Tools
JSON Formatter
Format, validate and beautify JSON data instantly. Free online JSON formatter, no signup needed.
URL Encoder
Encode or decode URLs instantly online. Free URL encoder and decoder, no account needed.
JWT Decoder
Decode and inspect any JWT token instantly. Free online JWT decoder with header and payload display.
HTTP Headers Checker
Inspect HTTP response headers for any URL. Free online header checker for developers.
URL Parser
Parse and analyze any URL into its components instantly. Free online URL parser tool.
Hash Generator
Generate MD5, SHA-1, SHA-256 and SHA-512 hashes from any text. Free online hash generator.