Base64 Encoder & Decoder

Paste Base64 to decode it back to text or a downloadable file, or encode text and files (images, PDFs) to Base64 and data URIs. Everything happens in your browser.

What do you want to do?

Runs in your browser; nothing you type is sent anywhere. · Updated

How to use the Base64 tool

Task Steps
Decode Base64 Choose Decode Base64 and paste. Text appears instantly; images show a preview; other files get a download button.
Encode text Choose Encode text and type. Tick URL-safe for use in URLs and file names.
Encode a file Choose File → Base64 and pick a file. Tick data URI to get a string you can drop into HTML or CSS.

Data URI prefixes (data:image/png;base64,), line breaks and URL-safe characters are handled automatically when decoding.

What Base64 is

Base64 represents any data using 64 safe characters: A–Z, a–z, 0–9, + and /, with = as padding. Every 3 bytes become 4 characters, so encoded data is about 33% larger than the original. It's used to put binary data where only text is allowed: email attachments (MIME), data URIs in web pages, JSON and API payloads, and basic authentication headers.

Base64 is not encryption. Anyone can decode it; don't use it to hide passwords or secrets.

Examples

Text Base64
Hi SGk=
Hello SGVsbG8=
Hello, world! SGVsbG8sIHdvcmxkIQ==

Standard vs. URL-safe Base64

Variant Characters 62 and 63 Padding
Standard (RFC 4648) + and / =
URL-safe (base64url) - and _ Usually omitted

URL-safe Base64 is common in JSON Web Tokens (JWTs) and URLs, because + and / have special meanings there.

Data URIs for images

A data URI embeds a small image directly in HTML or CSS: <img src="data:image/png;base64,iVBORw0…">. It saves a network request for tiny icons, but makes files larger and can't be cached separately, so use it for small images only.

Frequently asked questions

How do I decode a Base64 string?

Choose Decode Base64 and paste the string. If it's text you'll see it immediately; if it's an image or file you'll get a preview or a download.

Why does my decoded text look like gibberish?

The data is probably binary (an image, PDF or compressed file), not text. The tool detects common file types and offers a download instead.

Is it safe to paste sensitive data here?

The conversion runs entirely in your browser and nothing is sent to a server. Still, Base64 only encodes; it doesn't protect data.

What does the = at the end mean?

Padding. Base64 works in groups of 3 bytes; = or == fills the last group when the data length isn't a multiple of 3.