Skip to content

Base64 Encoder & Decoder

Encode text to Base64 or decode Base64 back to text, with full UTF-8 support (accents, emoji, any language) and URL-safe Base64URL. Turn files and images into Base64 or data URIs. Everything stays in your browser.
Base64
SGVsbG8sIHB1YmxpYyBBUElzISDwn5GL

Encode a file or image

Get a Base64 string or a data: URI for embedding in HTML, CSS or JSON. The file stays on your device.

What is Base64?

Base64 represents binary data using 64 safe characters (A–Z, a–z, 0–9, + and /). It's how bytes travel through text-only channels: email attachments, data URIs, JSON fields, HTTP Basic auth headers and the parts of a JWT.

Base64 vs Base64URL

Base64Base64URL
Characters 62 and 63+ and /- and _
PaddingRequired (=)Usually omitted
Used inEmail, data URIs, Basic auth, JSONJWTs, URLs, filenames

Base64 in code

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

// Node.js
Buffer.from("héllo").toString("base64");        // or "base64url"
Buffer.from(encoded, "base64").toString("utf8");

Base64 and APIs

You'll meet Base64 in API work when sending Basic auth credentials, embedding images in JSON (e.g. to OCR or image APIs), and decoding tokens. If an API returns Base64 data, paste it here to see what's inside, or format the surrounding response with the JSON formatter.

Frequently asked questions

Is Base64 encryption?

No. Base64 is an encoding: it turns bytes into text so they survive systems that only handle text. Anyone can decode it instantly, so never use it to hide passwords or API keys.

Why does Base64 end with = or ==?

Base64 encodes 3 bytes as 4 characters. When the input length isn't a multiple of 3, = padding fills the last group: one = for 2 leftover bytes, two for 1. Base64URL usually drops the padding; this decoder accepts both.

What's the difference between Base64 and Base64URL?

Base64URL replaces + with - and / with _ (and usually drops = padding) so the result is safe in URLs, filenames and JWTs. Tick URL-safe to encode as Base64URL; decoding detects either automatically.

Why is Base64 bigger than the original?

Every 3 bytes become 4 characters, so Base64 is about 33% larger. That's why APIs usually accept file uploads as multipart form data rather than Base64 inside JSON.

How do I Base64-encode credentials for Basic auth?

Encode username:password (with the colon) and send it as Authorization: Basic <encoded>. For example, user:pass becomes dXNlcjpwYXNz. curl -u and our cURL converter do this for you.

More free developer tools