Base64 Encoder / Decoder
Encode plain text to Base64 or decode Base64 strings back to readable text instantly.
How to use this tool
- 1Paste your plain text or Base64 string into the left 'Input' textarea.
- 2Click Encode to convert plain text to Base64, or Decode to convert Base64 back to plain text.
- 3The result appears in the right 'Output' textarea — select all and copy it from there.
- 4If decoding fails (invalid Base64), a red error message appears below the buttons.
About Base64 Encoder / Decoder
This Base64 encoder and decoder translates between plain text and the A-Za-z0-9+/= alphabet without a local script. Use it to embed a small credential in a header, pass bytes through a JSON field, or reverse a Base64 blob someone dropped in a ticket.
Base64 exists because not every channel accepts raw binary or reserved characters. Email attachments, basic auth headers, data URLs, and some config stores expect encoded strings. Decoding the wrong blob produces mojibake that looks like encryption when it is only a charset mismatch. Encoding the same data twice creates garbled double-encoded strings that are hard to debug.
Paste plain text and encode to Base64, or paste Base64 and decode to text. Encoding uses the browser's binary-to-ASCII path for the UTF-8 bytes of your string. Decoding rejects illegal alphabets and bad padding with a visible error instead of silently corrupting output. Results appear in the output panel for copy. Processing stays client-side.
Standard Base64 uses + and / with = padding. URL-safe variants substitute - and _ and sometimes drop padding — this tool targets the common text Base64 path, so URL-safe input may need normalization first. Decoding text that was encoded from a different charset can look wrong even when the Base64 is valid. Whitespace inside Base64 should usually be stripped before decode.
Encode a password for a quick Authorization: Basic experiment on a staging API. Decode a JWT payload segment after base64url normalization if you are inspecting claims by hand. Round-trip a UTF-8 phrase to confirm your pipeline does not mangle emoji. Prepare a small inline fixture for docs that forbid raw binary. Undo an accidentally double-encoded secret by decoding twice carefully.
Queries such as encode text to base64 online, decode base64 string to text, base64 encode utf-8, and fix invalid base64 padding map here. This is not AES, not hashing, and not image-to-data-URL specialized tooling — use the right sibling tool for images.
Base64 is encoding, not secrecy; anyone can decode. Missing = padding often fails decode until you restore length mod 4. Copying Base64 from PDF logs sometimes introduces line breaks that break strict decoders. Decoding binary that is not UTF-8 text yields replacement characters — you may need a hex viewer elsewhere.
Never paste production private keys into a shared demo machine. Even with local processing, clipboard history and screen recordings leak. Encode sample data when teaching; rotate anything real that touched an untrusted environment.
In integration tests, assert both directions: encode a known UTF-8 fixture, compare to a golden Base64 string, then decode back and compare to the original. That round trip catches accidental charset flags and platform line-ending interference. Security reviews should treat Base64 blobs in source code as readable data — scanners and humans can decode them in seconds.
When transporting Base64 through YAML or env files, quote carefully so hash comments or leading asterisks do not truncate values. After pasting an encoded secret into config, decode once in a safe local context to ensure integrity before deploying. A single truncated character yields padding errors that look mysterious in production logs.
Code examples
JavaScript
// Encode (handles Unicode / emoji)
const encode = (str) =>
btoa(unescape(encodeURIComponent(str)));
// Decode
const decode = (b64) =>
decodeURIComponent(escape(atob(b64)));Python
import base64
encoded = base64.b64encode("hello 🌍".encode()).decode()
decoded = base64.b64decode(encoded).decode()Frequently asked questions
Illegal characters, wrong padding length, or URL-safe alphabets without conversion commonly trigger failure. Strip whitespace and confirm the alphabet is standard +/ with = padding when required. Fix the input, then decode again. This error path is doing its job by refusing to invent bytes.
Encoding empty input yields an empty Base64 result rather than a crash. That edge case surprises people expecting a padding-only token. If you needed a non-empty ciphertext, you pasted nothing. Confirm the input panel before you assume the encoder broke. In practice, re-run Base64 Encoder / Decoder on a smaller sample after each change so you can see which input detail caused the mismatch. Keep the original nearby until you trust the export.
Valid Base64 can still represent bytes that are not UTF-8 text. The decoder may show replacement characters when the byte sequence is binary or another charset. Verify the producer encoding, or inspect hex elsewhere for non-text payloads. Garbled output after a clean decode is a charset scenario, not always a Base64 bug.
No. Base64 is reversible encoding for transport. Hashing is one-way verification. Encoding a password in Base64 does not protect it. Use proper password hashing and TLS for secrets; use Base64 only when a protocol requires ASCII-safe bytes. In practice, re-run Base64 Encoder / Decoder on a smaller sample after each change so you can see which input detail caused the mismatch. Keep the original nearby until you trust the export.
Base64 is denser than hex and common in HTTP and MIME contexts. Hex is easier to eyeball byte-by-byte in debugging dumps. Choose Base64 for protocol compatibility and hex for human nibble inspection. Converting between them is a separate step when tools disagree. In practice, re-run Base64 Encoder / Decoder on a smaller sample after each change so you can see which input detail caused the mismatch. Keep the original nearby until you trust the export.
JWT segments often use URL-safe alphabets and omit padding. You may need to replace - and _ and restore padding before a strict standard decode succeeds. Failing to normalize is a frequent JWT inspection scenario. After normalization, decode and pretty-print the JSON claims separately. In practice, re-run Base64 Encoder / Decoder on a smaller sample after each change so you can see which input detail caused the mismatch. Keep the original nearby until you trust the export.
Pasting binary into a text box corrupts bytes that are not valid text. For files, use an image-to-Base64 or file-oriented encoder that reads ArrayBuffers. This tool targets textual encode and decode workflows. Trying to paste a PNG into the text field is a failure scenario to avoid.
Yes. Pipelines sometimes encode an already-encoded string, producing a longer ASCII blob that decodes to Base64 text instead of the original. Decode once and inspect; if you still see A-Za-z0-9+/= structure, decode again. Document which layer owns encoding to stop the loop. In practice, re-run Base64 Encoder / Decoder on a smaller sample after each change so you can see which input detail caused the mismatch. Keep the original nearby until you trust the export.