365tools

Base64 Encoder / Decoder — Free & Private

Encode text or files to Base64 or decode Base64 back to text. URL-safe mode supported. Everything runs in your browser — no server, no upload.

Encode & Decode

Switch between encode and decode modes with one click. Swap output to input instantly.

No Upload

btoa/atob run entirely in your browser. No data leaves your device.

File Support

Encode any file to a Base64 data URL — images, PDFs, anything.

Plain text

Base64

Common uses for Base64 encoding

  • Embedding images in HTML — Use a Base64 data URL as an img src to avoid an extra HTTP request for small icons.
  • HTTP Basic Authentication — Credentials are encoded as Base64 in the Authorization header.
  • JSON payloads — Binary data (images, files) can be embedded in JSON as Base64 strings.
  • Email attachments — MIME encoding uses Base64 to include binary attachments in plain-text email protocols.
  • JWT tokens — The header and payload of a JWT are Base64URL-encoded JSON objects.
  • CSS background images — Small inline images in background-image: url(data:...).

Frequently asked questions

What is Base64 encoding?

Base64 is an encoding scheme that converts binary data into ASCII text using 64 printable characters (A-Z, a-z, 0-9, +, /). It is commonly used to transmit binary data over text-only channels such as email (MIME), embed images in HTML or CSS, and pass binary data in JSON or URL parameters.

What is URL-safe Base64?

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

Is my data sent to a server when I encode or decode?

No. This tool uses the browser's built-in btoa() and atob() functions. All encoding and decoding happens locally in your browser tab. Nothing is ever transmitted over the network.

Can I encode files to Base64?

Yes. Click 'Encode file' to select any file from your device. The tool reads it into browser memory and encodes it as a Base64 data URL (data:[mime-type];base64,[data]) which you can copy and embed in HTML, CSS, or JSON.

What are common uses of Base64 in web development?

Base64 is used to: embed small images directly in HTML/CSS as data URLs, encode authentication credentials in HTTP Basic Auth headers, transmit binary data in JSON payloads, store binary data in text-only formats like XML, and pass binary data in URL query parameters.

Why does my Base64 string end with == or =?

Base64 encodes every 3 bytes into 4 characters. If the input is not a multiple of 3 bytes, padding = signs are added to complete the final group. One = means the last group had 2 bytes; two == means it had 1 byte. URL-safe mode strips this padding.

Related developer tools