How to Use Base64 Encoding and Decoding

Base64 is everywhere in modern software — APIs, Data URLs, email attachments, configuration files. This guide explains what Base64 is, how it works, and how to use a free browser-based Base64 encoder and decoder.

Try the Base64 Encoder & Decoder

What is Base64?

Base64 is an encoding scheme that represents binary data using a limited set of 64 ASCII characters: A–Z, a–z, 0–9, + and /. The = character is used for padding. Because Base64 uses only printable ASCII characters, it can safely travel through text-based systems that would otherwise corrupt or reject raw binary data.

What is a Base64 Encoder?

A Base64 Encoder converts text or binary data into a Base64 string. Text is first encoded as UTF-8 bytes, then those bytes are represented as Base64 characters. The result is a string like SGVsbG8gV29ybGQ= that can be safely stored, transmitted or embedded in text-based formats.

What is a Base64 Decoder?

A Base64 Decoder converts a Base64 string back into the original bytes. If the original data was text, those bytes are interpreted as UTF-8 to produce readable text. If the original data was a file (an image, a PDF, a zip), the bytes can be saved as a downloadable file.

Why is Base64 Used?

Base64 is used wherever binary data needs to pass through a text-only channel:

  • APIs — embedding images or files in JSON payloads
  • Data URLs — embedding small assets directly in HTML or CSS (data:image/png;base64,...)
  • Email — MIME attachments are Base64-encoded so binary files can travel through email
  • Configuration — storing secrets, tokens or certificates in text config files
  • Transferring binary data — through JSON, XML or URL query parameters
  • Embedding small assets — icons, fonts or small images in web pages

Is Base64 Encryption?

No. Base64 is encoding, not encryption. Anyone who has the Base64 string can decode it instantly — no key is needed. Base64 does not protect confidentiality. Do not use Base64 as a security mechanism or describe it as one.

Does Base64 Increase File Size?

Yes. Base64 represents every 3 bytes of input as 4 characters, so the encoded output is approximately 33% larger than the original data. Padding and line breaks can affect the final size slightly. This overhead is the trade-off for safe text-based transport.

What is Base64URL?

Base64URL is a URL-safe variant of Base64. It replaces + with - and / with _, so the result can be used in URLs and filenames without escaping. Padding (=) is often omitted in Base64URL. Base64URL is not identical to standard Base64 — the character set differs, and the two are not interchangeable without conversion.

Base64 vs Encryption

  • Base64 — encoding, reversible by anyone, not secret, no key required
  • Encryption — uses cryptographic algorithms, designed to protect confidentiality, requires a key to decrypt

Use Base64 when you need to transport or store binary data in a text format. Use encryption when you need to keep data confidential.

How to Encode Text to Base64

  1. Choose the Encode mode (Text → Base64).
  2. Paste or type your text into the input editor.
  3. Choose Standard Base64 or Base64URL.
  4. Click Encode to Base64.
  5. Copy or download the result.

How to Decode Base64

  1. Choose the Decode mode (Base64 → Text).
  2. Paste your Base64 string into the input editor.
  3. Click Decode Base64.
  4. If the result is valid UTF-8 text, it is displayed in the output editor. If the result is binary, switch to File Decode mode to download it as a file.

How to Encode a File to Base64

  1. Choose the File Encode mode (File → Base64).
  2. Upload a file (up to 10 MB).
  3. Click Encode File.
  4. Copy the Base64 string, download it as a .txt file, or copy the Data URL for inline use.

How to Decode Base64 to a File

  1. Choose the File Decode mode (Base64 → File).
  2. Paste a Base64 string or a Data URL (data:image/png;base64,...).
  3. If a Data URL is detected, the MIME type is identified automatically. For raw Base64, select the output file type.
  4. Click Decode to File.
  5. Download the decoded file with the appropriate extension.

Privacy

Because Base64 encoding and decoding are pure operations, they run entirely in your browser. Your text, files and Base64 strings are never uploaded to a server, and your data is not included in analytics. Try the Base64 Encoder & Decoder now, or use the JSON Validator to validate and format JSON.

Try these tools

Frequently asked questions

Is Base64 encryption?+

No. Base64 is encoding, not encryption. Anyone with the Base64 string can decode it instantly without a key. Do not use Base64 as a security mechanism.

Does Base64 increase file size?+

Yes. Base64 represents every 3 bytes as 4 characters, so the encoded output is approximately 33% larger than the original data.

What is Base64URL?+

Base64URL is a URL-safe variant that replaces + with - and / with _, so the result can be used in URLs and filenames without escaping. It is not identical to standard Base64.