什麼是 Base64?
- 瞭解
- 使用
"Base64" is often seen in developer documentation and APIs. Before using Convert Files and Base64, here are the basics of what it is for.
What Base64 is
A method of turning data (binary) such as images and PDFs into a string using only letters, digits and a few symbols. The characters used are upper and lower case letters, digits, "+" and "/", and "=" at the end.
Why it is needed
Email bodies and some communication mechanisms can handle only text. Putting binary data in as it is would corrupt it. Turned into text with Base64, it can be safely put even in text-only places.
Steps (trying it)
- For "Direction", choose "File → Base64".
- Choose a small image or text with "Choose one file".
- Look at the string that appears under "Base64 after conversion".
Characteristics of Base64
- Reversible: it can be returned fully to the data before conversion.
- Expressed in text only: can be pasted anywhere.
- Size increases: about 1.3 times.
- Not a cipher: anyone can restore it.
Common uses
- The mechanism for sending attachments by email
- Embedding small images in HTML or CSS (data URLs)
- Exchanging files as text through APIs
- Putting binary in configuration files
Difference from "encryption"
Base64 only expresses data in another form, and anyone can restore it without a key. Putting a password or secret information into Base64 does not protect it.
How to recognise it
- Made only of letters, digits, "+" and "/"
- Sometimes ends with "="
- A long, meaningless line of characters
示例
An API description said "send images in Base64". Used this tool to turn an image into Base64 and see.
Common stumbling blocks
- Mistaking it for encryption: it is no security measure.
- Line breaks included: for email and the like, line breaks may be inserted every 76 characters.
Frequently asked questions
Does Base64 make the size smaller?
No. It grows to about 1.3 times.
小結
Base64 is a method of turning data into text. Remember it is not a cipher and increases size.
使用「檔案與 Base64 互相轉換」(免費)搭配使用的工具
- 檢視檔案的雜湊值(SHA-256):計算檔案的雜湊值並進行比對。
- CSV 與 JSON 互相轉換:立即在 CSV 和 JSON 之間互相轉換。
- 把檔案打包成 ZIP:把多個檔案打包成一個 ZIP。