Tools / File → Base64 Encoder

File → Base64 Encoder.

Encode any file to Base64 or a data URI, with URL-safe and MIME line-wrapping options.

Runs in your browser
or drop a file here

76 characters per line for MIME (email), 64 for PEM.

Ctrl/⌘ + Enter to run · Ctrl/⌘ + Shift + C to copy the result

Result
Base64
Data URI
Details

About File → Base64 Encoder

File → Base64 reads any file in your browser and encodes its bytes as Base64. Use it when an API expects a file inside JSON (many e-signature, OCR and email APIs take attachments as Base64 strings), when you need a font or a small PDF inline as a data URI, when a Kubernetes secret or CI variable must hold a certificate, or when you just want to check what a service will receive. Drop a file of up to 20 MB, or paste text if you only need to encode a string. You can choose the standard alphabet, the URL-safe alphabet (- and _ instead of + and /) used by JWTs and URL parameters, or URL-safe without = padding. Line wrapping at 76 characters matches MIME email bodies, and 64 characters matches PEM files; leave it off for JSON, because embedded new lines break many parsers. The details panel shows the file size, the encoded length, the roughly 33% overhead and a SHA-256 checksum, so the receiver can confirm the decoded file is identical. The data URI output uses the file's MIME type, or the type detected from its magic bytes when the browser does not report one. Common mistakes: encoding the file name instead of the file, adding a data: prefix where the API expects bare Base64 (or the other way round), using the URL-safe variant where standard Base64 is required, and sending very large files as Base64 when a multipart upload would be smaller. To decode Base64 back to a file or text, use the Base64 tool. The file never leaves your device.

How to Use

  1. Drop a file into the drop zone, or paste text instead.
  2. Choose the Base64 variant and optional line wrapping.
  3. Copy the Base64 string or the data URI; compare the SHA-256 after decoding if needed.

Frequently Asked Questions

How much bigger is Base64 than the file?

About 33%. Every 3 bytes become 4 characters, plus padding and any line breaks.

Should I use standard or URL-safe Base64?

Use standard Base64 for JSON bodies, email and most APIs. Use URL-safe when the value goes into a URL, a file name or a JWT, because + and / have special meanings there.

Is there a size limit?

Files up to 20 MB. The SHA-256 checksum is skipped for files over 5 MB to keep the page responsive.

Is my file uploaded?

No. The file is read and encoded locally in your browser.

Related Tools