Base64 Encoder & Decoder

Encode text and files to Base64 and decode Base64 strings online instantly. Supports standard and URL-safe Base64, file uploads, and binary-safe encoding — works offline.

Drop a file here or click to upload — converts to Base64
Text Input
Base64 Output
Paste text and click Encode

About the Base64 Encoder & Decoder

The DevToolHeaven Base64 Encoder and Decoder converts text and files to Base64 format and decodes Base64 strings back to their original form. Base64 encoding is widely used for embedding binary data in text-based formats, transmitting data over HTTP, and storing binary content in JSON or XML.

Switch between Encode and Decode modes using the toggle. For files, drag and drop any file onto the upload zone — the tool reads it and converts it to Base64 instantly. Use the URL-safe option when the Base64 output will be used in URLs, query strings, or file names without percent-encoding.

Base64 works by taking every three bytes of input and converting them to four printable ASCII characters from a 64-character alphabet (A–Z, a–z, 0–9, +, /). This means Base64 output is approximately 33% larger than the original. The equals sign (=) at the end is padding added when the input length is not divisible by three.

Standard Base64 uses + and / characters, which have special meaning in URLs. URL-safe Base64 (Base64URL) replaces + with - and / with _, making the output safe to embed in URLs and file names. JWT tokens use URL-safe Base64 internally for their header and payload sections.

Common use cases include: embedding images in HTML or CSS as data URIs, encoding binary email attachments in MIME format, transmitting credentials in HTTP Basic Auth headers, storing binary blobs in JSON APIs, and encoding file contents for APIs that only accept text input.

All encoding and decoding happens entirely in your browser using JavaScript's built-in btoa() and atob() functions. No data is uploaded to any server — your files and text stay entirely on your device.

Frequently Asked Questions

Base64 is an encoding scheme that converts binary data into a text string using 64 printable ASCII characters. It is commonly used to encode binary data for transmission over text-based protocols like email and HTTP, and for embedding images or files directly in HTML, CSS, or JSON.

Base64 is encoding, not encryption. Encoding transforms data into a different format for compatibility or transmission — it is not secure and can be reversed by anyone. Encryption uses a secret key to make data unreadable without the key. Never use Base64 to secure sensitive data.

Standard Base64 uses + and / characters which have special meaning in URLs. URL-safe Base64 replaces + with - and / with _, and removes = padding. This makes the encoded string safe to use in URLs and file names without percent-encoding.

This usually means the Base64 string was encoded from binary data (like an image or PDF) rather than plain text. Binary files encoded in Base64 cannot be displayed as readable text — they must be decoded back to their binary form and saved as a file.

Use the file upload feature — drag and drop your image file onto the upload zone or click to select it. The tool reads the file and converts it to Base64 automatically. You can then use the Base64 string to embed the image directly in HTML using a data: URL.

Base64 encoding increases data size by approximately 33 percent. This is because every 3 bytes of binary data are represented as 4 ASCII characters. This overhead is a trade-off for text compatibility and is generally acceptable for small files and inline data.

Common uses include: embedding images in HTML or CSS as data URIs (src="data:image/png;base64,..."), encoding binary email attachments in MIME format, transmitting credentials in HTTP Basic Auth headers (username:password encoded as Base64), storing binary blobs in JSON APIs, and encoding file contents for APIs that only accept text input.

The = padding characters appear when the input length is not divisible by 3 bytes. One = means 1 padding byte was added; == means 2 padding bytes were added. This is specified in the Base64 standard and completely normal. Some implementations omit padding, which is also valid when the receiver knows to expect it — URL-safe Base64 in particular often drops padding.

Encode your image file using the file upload feature, then copy the Base64 output. Use it in an img tag like this: <img src="data:image/png;base64,YOUR_BASE64_HERE">. Replace "image/png" with the correct MIME type (image/jpeg, image/gif, image/svg+xml). This embeds the image directly in the HTML without a separate file request.

Upload your file using the file upload zone — the tool reads it locally and converts it to Base64 automatically. Copy the output and include it in your API request body as a string field. Many APIs that accept file uploads also accept Base64-encoded file content in a JSON payload.

There is no hard limit — encoding depends on available browser memory. In practice, files up to 10MB encode instantly. Files of 50MB or more may take a few seconds. For very large files, command-line tools like base64 (macOS/Linux) or certutil -encode (Windows) are faster.

Use the built-in atob() function: const decoded = atob("SGVsbG8gV29ybGQ="); For URL-safe Base64 (with - and _ instead of + and /), replace them first: atob(base64url.replace(/-/g, "+").replace(/_/g, "/")). In Node.js, use Buffer.from(str, "base64").toString("utf8").