Text Base64 Encoder
Encode or decode UTF-8 text with Base64
Text Base64 Encoder — what it does
Encode UTF-8 text into Base64 or decode a Base64 string back into readable text. Base64 turns arbitrary characters into a restricted alphabet that survives transmission through systems designed for plain ASCII, which is why it appears in headers, tokens and configuration files everywhere.
Worked example
A reminder containing Chinese characters and an em dash, encoded with the Encode button. Pasting the result back and clicking Decode returns the original text exactly.
Input — text
Reminder: 報告 due Fri 17:00 — thanks, Ann
Output — Base64
UmVtaW5kZXI6IOWgseWRiiBkdWUgRnJpIDE3OjAwIOKAlCB0aGFua3MsIEFubg==
The 40-character input becomes 64 characters: the Chinese characters and the dash take three bytes each in UTF-8 before encoding, and == pads the final group.
When this tool helps
- Decoding a Base64 value found in a configuration file, header or log entry.
- Encoding a credential or string for a system that expects Base64 input.
- Reading the payload of a token or an encoded parameter.
How to use it
- Paste the text or the Base64 string.
- Choose encode or decode.
- Read the output.
- Copy the result.
Accuracy, limits, and good practice
- Base64 is encoding, not encryption. Anyone can decode it, so it protects nothing — it only makes data transport-safe.
- URL-safe Base64 replaces two characters and often drops padding; convert it back before decoding if a string will not parse.
- Encoded output is about a third larger than the input, which matters when the result travels in a header or a URL.
- Decoding is the useful direction most days: values in headers, config files and tokens are usually already encoded and just need reading.
Frequently asked questions
Why does my decode produce garbled text?
Usually the input is not valid Base64, is truncated, or was encoded from bytes that are not UTF-8 text.
Is Base64 secure?
No. Treat anything Base64-encoded as plainly readable, because it is.
How do I encode a file rather than text?
Use the file Base64 tool, which handles binary files and can decode back into a downloadable file.
Why is there an equals sign at the end?
Padding. Base64 works in groups of three bytes, and one or two equals signs mark an input that did not divide evenly.
Can I decode Base64 that has been wrapped onto several lines?
Yes. Line breaks and spaces inside the string are ignored by the decoder, so a value copied from an email or a certificate-style block decodes without rejoining the lines; leading and trailing whitespace is trimmed as well.
What happens if the string contains - or _ or is missing its padding?
Those come from the URL-safe variant. The decoder uses the standard alphabet only, so a - or _ makes it fail and the browser's error message ("The string to be decoded is not correctly encoded.") appears in the output box instead of text. Replace - with + and _ with / first. Missing = padding is tolerated as long as the remaining length is valid.
Related tools on this site
- Email Address Extractor — Find and clean email addresses from pasted text
- JSON to YAML — Convert JSON data into readable YAML
- Regex Tester — Test regular expressions and inspect every match
Further reading: Cleaning Up Text You Pasted From Somewhere Else
Everything above runs inside this page. Text Base64 Encoder needs no account, no upload, and no server round trip — close the tab and nothing is left behind.
文字 Base64 編解碼能做什麼
把 UTF-8 文字編碼成 Base64,或把 Base64 字串解碼回可讀文字。Base64 把任意字元轉成受限字母集,好通過那些為純 ASCII 設計的系統,這也是它出現在標頭、權杖與設定檔中的原因。
實際範例
一則含中文字與長破折號的提醒,按「編碼」轉成 Base64。把轉換後的字串貼回去按「解碼」,可以一字不差還原成原文。
來源:文字
Reminder: 報告 due Fri 17:00 — thanks, Ann
轉換後:Base64
UmVtaW5kZXI6IOWgseWRiiBkdWUgRnJpIDE3OjAwIOKAlCB0aGFua3MsIEFubg==
40 個字元的原文變成 64 個字元:中文字與破折號在 UTF-8 裡各佔三個位元組,最後一組以 == 補齊。
什麼時候用得上
- 解碼設定檔、標頭或日誌中看到的 Base64 值。
- 為需要 Base64 輸入的系統編碼憑證或字串。
- 讀取權杖或編碼參數的內容。
使用步驟
- 貼上文字或 Base64 字串。
- 選擇編碼或解碼。
- 查看輸出。
- 複製結果。
精確度、限制與實務建議
- Base64 是編碼、不是加密。任何人都能解碼,它保護不了任何東西,只是讓資料能安全傳輸。
- URL 安全版 Base64 會替換兩個字元、常省略補位;字串解不開時請先轉回標準形式。
- 編碼後約比原文大三分之一,當結果要放進標頭或網址時就要留意。
- 日常最常用的其實是解碼:標頭、設定檔與權杖裡的值多半已經編碼過,需要的只是把它讀出來。
常見問題
為什麼解出來是亂碼?
通常是輸入並非合法 Base64、被截斷,或原本編碼的位元組本來就不是 UTF-8 文字。
Base64 安全嗎?
不安全。凡是 Base64 編碼的內容,都請當成明文看待,因為它本來就是。
我要編碼檔案而不是文字怎麼辦?
請用檔案 Base64 工具,它能處理二進位檔,也能解碼回可下載的檔案。
結尾的等號是什麼?
那是補位。Base64 以三個位元組為一組,結尾一到兩個等號代表輸入長度無法整除。
被折成好幾行的 Base64 也能解碼嗎?
可以。解碼器會忽略字串中間的換行與空格,所以從郵件或憑證區塊複製的值不必先接回一行就能解碼;頭尾的空白也會被修剪。
字串裡有 - 或 _、或少了補位符號會怎樣?
那是 URL 安全變體的寫法。解碼器只接受標準字母表,遇到 - 或 _ 會失敗,並把瀏覽器的錯誤訊息(The string to be decoded is not correctly encoded.)顯示在原本放文字的位置。請先把 - 換成 +、_ 換成 /。結尾少了 = 補位則沒有關係,只要剩餘長度合法就能解碼。
本站相關工具
- Email 地址提取器 — 從貼上的文字中找出並整理 Email 地址
- JSON 轉 YAML — 將 JSON 轉換為易讀的 YAML
- 正規表示式測試器 — 測試 Regex 並查看所有符合結果
延伸閱讀: 清理從別處貼上的文字
以上步驟全部在這個頁面內完成,文字 Base64 編解碼 不需要註冊、不上傳檔案、也不經過伺服器,關閉分頁後不會留下任何資料。