File Encoding

File to Base64

Encode images, PDFs, ZIPs, or other files as Base64 text while preserving every original byte.

All files are processed only in your browser and are never uploaded to a server.

About this tool

File to Base64 represents binary contents as text you can copy or save. Choose raw Base64 or a Data URI with a MIME label. The original file format is not converted.

How to use

  1. Select a local file no larger than 20 MiB.
  2. Choose raw Base64 or Data URI output.
  3. Review the original file information, output length, and estimated text size.
  4. Copy a short result or download the complete result as TXT.

Features

  • Works with any file type, including files other than images.
  • Encodes bytes directly. Text files are not decoded into characters first.
  • Offers raw Base64 and Data URI output.
  • Download large results as TXT instead of relying on the clipboard.

Encoding details

  • Base64 is usually about one-third larger than the original binary data. Its text representation in the browser uses additional memory.
  • The Data URI uses the file's MIME label. If no type is available, it uses application/octet-stream.
  • Output is displayed only as text. HTML, SVG, JavaScript, and similar contents are not previewed or executed.

Limits

  • The original file must be no larger than 20 MiB. Devices with limited memory may need smaller files even below that limit.
  • Copying is limited to 1 MiB of text. Download larger results as TXT. Clipboard access depends on your browser's permissions and security requirements.

Privacy

All files are processed only in your browser and are never uploaded to a server.

File names, entered text, and results are processed only in your current browser. Your input is not saved automatically. Download any results you want to keep before clearing the tool or leaving the page.

FAQ

Is Base64 a compression format?

No. It represents binary bytes as copyable text. It does not compress files or automatically convert their formats.

Why is Base64 larger than the original file?

Every 3 original bytes usually become 4 Base64 characters, increasing the length by about one-third. Short inputs may include padding. A Data URI also adds a short type label.

Can I use any file type?

Yes, within the size limits. Images, PDFs, ZIPs, text, and other files can be encoded or decoded without being automatically opened or executed.

Are files uploaded?

All files are processed only in your browser and are never uploaded to a server.

Will encoding and decoding restore the same file?

Decoding the complete, unchanged Base64 should reproduce the original bytes. You can compare SHA-256 values with the File Hash Calculator.

Back to Developer Tools