100% Free · Runs In Your Browser

Base64 Decoder & Encoder

Decode Base64 to text, encode text to Base64, turn a Base64 string into an image you can download, or convert an image file to Base64. Works with UTF-8 and URL-safe Base64, and nothing leaves your browser.

Base64 encoder and decoder

Options

Everything is processed locally in your browser. Your text and images are never uploaded.

What Is Base64?

Base64 turns binary data into plain text made of 64 characters: the letters A–Z and a–z, the digits 0–9, and two symbols, usually + and /. Every 3 bytes become 4 characters, and an = sign pads the end when the length does not divide evenly. The format is defined in RFC 4648. It exists so that data such as images, files and keys can travel through systems that only handle text: email, JSON, HTML, CSS and URLs.

How to Decode a Base64 Image

Switch to the Image tab, paste the string and press Decode to image. You can paste the full data URI (data:image/png;base64,...) or only the part after the comma. The decoder reads the first bytes of the result to find the real format, so it still works when the prefix is missing or wrong. You then see a preview, the pixel dimensions and the file size, and you can download the picture as a normal file.

To go the other way, choose an image in the Image to Base64 box. You can copy the plain Base64, a ready-to-use data URI, or a complete <img> tag.

Base64 Is Not Encryption

Base64 only changes how data is written. It does not need a key, and anyone can reverse it. A password stored as Base64 is as exposed as one stored in plain text. If you need a secret value, create a random one with the Strong Password Generator or, for API keys and tokens, the Developer Credential Generator, which can output Base64URL.

Standard vs URL-Safe Base64

StandardURL-safe (Base64URL)
Characters 62 and 63+ and /- and _
PaddingUsually =Often left out
Used inEmail, data URIs, most APIsJWTs, URLs, file names

The decoder accepts both forms automatically and does not need the padding. Tick the URL-safe box when you encode if the result is going into a URL or a token.

Base64 in Your Own Code

// JavaScript in the browser (UTF-8 safe)
const bytes = new TextEncoder().encode("héllo");
const b64 = btoa(String.fromCharCode(...bytes));
const text = new TextDecoder().decode(Uint8Array.from(atob(b64), c => c.charCodeAt(0)));

// Node.js
Buffer.from("hello").toString("base64")        // aGVsbG8=
Buffer.from("aGVsbG8=", "base64").toString()   // hello

# Python
import base64
base64.b64encode(b"hello").decode()            # aGVsbG8=
base64.b64decode("aGVsbG8=")                   # b'hello'

# Linux / macOS terminal
echo -n hello | base64
echo aGVsbG8= | base64 --decode

# PowerShell
[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("hello"))
[Text.Encoding]::UTF8.GetString([Convert]::FromBase64String("aGVsbG8="))

The plain btoa() function in browsers only accepts Latin-1 characters and throws an error on emoji or most non-English text, so convert the text to UTF-8 bytes first, as in the first example.

When Not to Use a Base64 Image

Inlining an image as a data URI saves one request, but it makes the data about 33 percent bigger, the browser cannot cache it separately, and it bloats your HTML or CSS. It suits small icons and tiny placeholders. For photos, use a normal image file.

Frequently Asked Questions

Base64 is a way to write binary data, such as an image or a file, using only 64 safe text characters: A to Z, a to z, 0 to 9, plus and slash. It is used where only text is allowed, such as email, JSON, URLs and data URIs. It is an encoding, not a compression or an encryption method.

No. Anyone can decode Base64 in one click, as this page shows. It hides nothing, so never use it to protect passwords, tokens or personal data. For real secrets use proper encryption, and for passwords use the Strong Password Generator.

Open the Image tab, paste the Base64 string, with or without the data:image/...;base64, prefix, and press Decode to image. The tool detects the format from the file's first bytes, shows a preview with its size and dimensions, and lets you download it.

Base64 turns every 3 bytes into 4 characters, so the output is about 33 percent larger than the input, plus a little padding. That is why large images are usually better served as normal files than as inline data URIs.

Standard Base64 uses the plus and slash characters, which have special meaning in URLs. The URL-safe variant, called Base64URL in RFC 4648, replaces them with minus and underscore and often drops the trailing equals signs. JWTs use it. This tool can read both forms and write either.

The most common causes are extra characters that are not part of Base64, a string cut off in the middle, or a value that is not text, such as an image, being shown as text. This tool ignores spaces and line breaks and accepts missing padding. If it still fails, check that the string is complete.

No. Encoding and decoding run in your browser with JavaScript. Your text and images are never sent to our server, which also means the page works offline once it has loaded.

Explore All Free Tools

Password Generators

Account Password Generators

Security Tools

Guides

More Free Tools

Site