Base64 Encoder / Decoder

Encode and decode text and files to and from Base64. Supports drag-and-drop file upload.

Drag & drop a file here, or click to select

Images will show a preview with their data URL

What Is the Base64 Encoder / Decoder?

This tool encodes text and files into Base64 format and decodes Base64 strings back into readable content. Base64 is a binary-to-text encoding scheme used widely in web development, email systems, and APIs. Everything runs in your browser with no data sent to any server.

How to Encode Text to Base64

Make sure the mode is set to Encode. Type or paste your text into the input area. The Base64-encoded result appears instantly in the output panel. Click the copy button to copy the output to your clipboard.

How to Decode Base64 to Text

Switch the mode to Decode. Paste your Base64 string into the input area. The decoded plain text appears in the output. If the input is not valid Base64, an error message lets you know.

Encoding Files and Images

Drag and drop any file onto the upload area, or click to open a file picker. The tool reads the file and produces a data URL containing the Base64-encoded content. For image files, a visual preview is displayed so you can verify the result.

  • Supports all file types including images, PDFs, and documents.
  • Image files display an inline preview below the upload area.
  • The full data URL is shown in the output and can be copied.

Common Use Cases

  • Embedding small images directly in HTML or CSS as data URLs.
  • Encoding binary data for safe transmission in JSON APIs.
  • Preparing file attachments for email protocols.
  • Debugging encoded strings in authentication tokens or cookies.
  • Converting configuration files for use in environment variables.

Tips for Working with Base64

Keep in mind that Base64 increases data size by about a third. For large files, it is usually better to serve them as separate resources rather than embedding them inline. Base64 is ideal for small assets like icons and thumbnails where reducing HTTP requests matters more than payload size.

Frequently Asked Questions

What is Base64 encoding?+
Base64 encoding converts binary data into a text format using 64 ASCII characters. It is commonly used to embed images in HTML or CSS, transmit binary data over text-based protocols like email, and store data in JSON or XML.
How do I encode text to Base64?+
Select the Encode mode, type or paste your text into the input field, and the Base64-encoded output appears instantly. Click the copy button to grab the result for use in your project.
How do I decode a Base64 string?+
Switch to Decode mode and paste your Base64 string into the input field. The tool automatically converts it back to readable text. If the string is invalid Base64, an error message is displayed.
Can I convert an image to Base64?+
Yes. Drag and drop an image file onto the upload area, or click to select a file. The tool generates a data URL with the Base64-encoded image, and shows a preview if it is an image file.
Does Base64 encoding encrypt my data?+
No. Base64 is an encoding scheme, not encryption. Anyone can decode a Base64 string to view the original data. Do not use Base64 as a security measure for sensitive information.
Why is my Base64 output larger than the original?+
Base64 encoding increases data size by approximately 33%. Every three bytes of input become four characters of Base64 output. This overhead is the tradeoff for safe text-based transmission of binary data.

Related Tools

Base64 Encoder / Decoder — free online base64 encoder, base64 decoder, base64 encode online, decode base64 string, image to base64, file to base64, base64 converter, base64 text encoder. No signup required. Works in your browser.