Base64 Encoder/Decoder

Convert text and data to Base64 format and decode Base64 strings. Supports UTF-8 encoding and data URI generation.

What is Base64 Encoder/Decoder?

Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 printable ASCII characters (A–Z, a–z, 0–9, +, and /). It was originally designed to safely transmit binary content—like images, audio files, or arbitrary bytes—through systems that were only designed to handle plain text, such as email protocols (MIME) and early HTTP headers. Today, Base64 is everywhere in modern software: JSON Web Tokens (JWTs) encode their header and payload in Base64URL format; HTML and CSS can embed images directly as Base64 data URIs, eliminating extra HTTP requests; SMTP email attachments are Base64-encoded; and many APIs use Base64 to transmit binary data in JSON fields. One important distinction: Base64 is an encoding, not encryption. It does not protect data—anyone can decode a Base64 string instantly. Its sole purpose is safe text-safe representation of binary content. Base64 encoding increases data size by approximately 33% because every 3 bytes of input become 4 characters of output, which is the trade-off for universal text compatibility. This tool supports both standard Base64 and the URL-safe Base64URL variant used in JWTs and web tokens.

How to Use Base64 Encoder/Decoder

Choose the Encode or Decode tab depending on your task. To encode: type or paste your text into the input field, or switch to File Input to upload any file (image, PDF, binary). The tool instantly generates the Base64-encoded string in the output. Toggle the Data URI switch to wrap the output in a data:mime/type;base64, prefix, ready to embed directly in HTML img src attributes or CSS background-image properties. To decode: paste a Base64 string into the input field. The tool decodes it and displays the original text or, for binary files, shows a download button so you can save the reconstructed file. If the Base64 string is malformed or truncated, the tool reports an error rather than silently producing corrupted output. Use the Copy button to copy the result to your clipboard instantly, or use Download for binary file outputs. The tool automatically handles UTF-8 multi-byte characters, so accented letters and Unicode text encode and decode correctly.

FAQ

What is the difference between Base64 and Base64URL?

Standard Base64 uses + and / characters, which have special meaning in URLs and can break query strings. Base64URL replaces + with - and / with _ to make the encoded string safe for use in URLs, HTTP headers, and JWT tokens without percent-encoding. This tool supports both variants—use the URL-safe toggle for JWT or API token work.

Can I encode images and binary files?

Yes. Switch to the File Input tab and upload any file—images (PNG, JPEG, WebP, GIF, SVG), PDFs, fonts, audio files, or arbitrary binary data. The tool reads the file in your browser and converts it to a Base64 string. The Data URI option wraps it as data:image/png;base64,... which you can paste directly into an HTML src attribute or CSS background-image.

Why does Base64 output look longer than the original text?

Base64 encoding converts every 3 bytes of binary data into 4 ASCII characters, increasing size by approximately 33%. This size overhead is the cost of text-safe representation. For small embedded assets like icons it's acceptable, but for large images or files you should use standard file references and HTTP instead of Base64 embedding to avoid bloating your HTML or CSS.

Is Base64 the same as encryption?

No—Base64 is encoding, not encryption. It provides zero security. Anyone can decode a Base64 string instantly using any Base64 decoder. Never use Base64 to hide sensitive data like passwords or API keys. For actual security, use proper encryption algorithms like AES-256 or asymmetric encryption with RSA/ECDSA.

Why does my decoded Base64 show garbled characters?

This usually happens when the Base64 string was encoded from binary data (like an image or PDF) rather than plain text. Binary data decoded as text will appear as garbled characters. Use the File Download option instead of the text view when decoding binary content. Also check for padding issues—valid Base64 strings must have a length divisible by 4, padded with = characters if needed.