Developer Tools · 100% Client-Side

Base64 Encoder & Decoder Online

Instantly encode text to Base64 or decode Base64 to readable text. Supports URL-safe Base64 and file encoding. Your data never leaves your browser.

Advertisement
Standard Base64
URL-Safe
76-char line breaks

Plain Text Input

Base64 Output

Enter text or paste Base64 to get started.
🔒 100% Private: All encoding and decoding happens in your browser using JavaScript. No data is sent to any server. Safe for API keys, tokens, and sensitive content.
Advertisement

More Developer Tools

Frequently Asked Questions

What is Base64 encoding and when is it used?

Base64 is an encoding scheme that converts binary data (images, files, bytes) into a string of 64 printable ASCII characters. It is used in: email attachments (MIME encoding), embedding images in HTML/CSS as data URIs, storing binary data in JSON payloads, HTTP Basic Authentication headers (credentials encoded as base64), and JWT (JSON Web Tokens). Base64 increases data size by about 33%, so it is used for compatibility, not compression.

What is the difference between standard Base64 and URL-safe Base64?

Standard Base64 uses characters A-Z, a-z, 0-9, +, and /. The + and / characters are not URL-safe and must be percent-encoded in URLs (%2B and %2F). URL-safe Base64 (Base64url) replaces + with - and / with _, making the encoded string safe to use in URLs and filenames without percent encoding. JWTs use URL-safe Base64. For HTTP headers and URLs, always use URL-safe Base64.

How do I decode a Base64 string in JavaScript?

In JavaScript, use atob() to decode Base64 to a string and btoa() to encode: const encoded = btoa('Hello World'); // SGVsbG8gV29ybGQ= const decoded = atob('SGVsbG8gV29ybGQ='); // Hello World. For Node.js: Buffer.from('Hello World').toString('base64') to encode, and Buffer.from(encoded, 'base64').toString('utf8') to decode. For binary files, use Buffer.from(base64String, 'base64') to get the file bytes.

How do I use Base64 to embed an image in HTML?

To embed a Base64 image in HTML, use the data URI format: <img src="data:image/png;base64,YOUR_BASE64_HERE">. Replace image/png with the correct MIME type (image/jpeg, image/gif, image/svg+xml etc). This approach avoids a separate HTTP request, improving performance for small icons. However, for large images, Base64 significantly increases page size — use it only for small icons or when a separate request is undesirable.

Is Base64 the same as encryption?

No. Base64 is encoding, not encryption. Anyone can decode Base64 instantly without a key or password. Base64 offers zero security. It is used for encoding binary data to text-safe format, not for securing data. If you need to secure sensitive data, use actual encryption algorithms like AES-256. Never use Base64 as a security measure — for example, do not store Base64-encoded passwords thinking they are hidden.

Advertisement