64

File Base64 Encoder & Decoder

Convert any file to Base64 or restore Base64 data into a downloadable file

File Base64 Encoder & Decoder — what it does

Encode any file into a Base64 string, or paste Base64 back and decode it into a downloadable file with the name and MIME type you specify. Base64 is how binary data travels through text-only channels — JSON payloads, data URIs, configuration files — and this tool covers both directions of the trip.

When this tool helps

  • Embedding a small image or font as a data URI in CSS or HTML.
  • Preparing a file payload for an API that accepts Base64 in JSON.
  • Recovering an attachment from a raw Base64 block found in an email source or a log.

How to use it

  1. To encode: choose a file and copy the Base64 output.
  2. To decode: paste the Base64 string.
  3. Set the output filename and MIME type.
  4. Download the reconstructed file.

Accuracy, limits, and good practice

  • Base64 inflates size by about a third; a 3 MB file becomes roughly 4 MB of text, which is why it suits small assets, not archives.
  • For data URIs, prefix the string with data:, the MIME type and ;base64, — the tool gives you the raw encoded part.
  • When decoding, strip any surrounding quotes, line breaks from email wrapping, or a data URI prefix first if the result fails to parse.

Frequently asked questions

Is Base64 encryption?

No. It is a reversible encoding anyone can decode. It provides transport safety, not confidentiality.

Why did my decoded file not open?

Usually the wrong MIME type or a truncated string. Verify the Base64 is complete and set a type matching the original file.

What does the MIME type field do?

It labels the download so the operating system and browser know which application should open it.

Related tools on this site

Everything above runs inside this page. File Base64 Encoder & Decoder needs no account, no upload, and no server round trip — close the tab and nothing is left behind.

檔案 Base64 編解碼能做什麼

把任意檔案編碼成 Base64 字串,或貼回 Base64 解碼成可下載的檔案,檔名與 MIME 類型由你指定。Base64 是二進位資料通過純文字通道的方式——JSON 載荷、data URI、設定檔——本工具把來回兩個方向都包了。

什麼時候用得上

  • 把小圖或字型以 data URI 內嵌進 CSS 或 HTML。
  • 為接受 JSON 內 Base64 的 API 準備檔案載荷。
  • 從郵件原始碼或日誌裡的 Base64 區塊還原附件。

使用步驟

  1. 編碼:選擇檔案並複製 Base64 輸出。
  2. 解碼:貼上 Base64 字串。
  3. 設定輸出檔名與 MIME 類型。
  4. 下載還原後的檔案。

精確度、限制與實務建議

  • Base64 會讓體積膨脹約三分之一;3 MB 的檔案變成約 4 MB 的文字,所以它適合小型資產,不適合封存。
  • 做 data URI 時請在字串前加上 data:、MIME 類型與 ;base64,——工具給的是純編碼部分。
  • 解碼失敗時,先移除前後引號、郵件換行或 data URI 前綴再試。

常見問題

Base64 是加密嗎?

不是。它是任何人都能還原的可逆編碼,提供的是傳輸相容性,不是保密性。

為什麼解碼出的檔案打不開?

通常是 MIME 類型不對或字串被截斷。請確認 Base64 完整,並設定與原檔相符的類型。

MIME 類型欄位是做什麼的?

它標示下載檔的類型,讓作業系統與瀏覽器知道該用哪個程式開啟。

本站相關工具

以上步驟全部在這個頁面內完成,檔案 Base64 編解碼 不需要註冊、不上傳檔案、也不經過伺服器,關閉分頁後不會留下任何資料。