← Back to DevKit

Base64 Encode / Decode

BASE64 · ENCODE & SECURITY

UTF-8-safe Base64 encoding and decoding — no garbled CJK text; independent encode and decode panels that never interfere.

Encode → BASE64
Drop an image / file to encode as Base64 and dataURL

    
Decode → UTF-8

    

>_ USAGE GUIDE

Paste plain text into the encode panel to get a Base64 string instantly, or paste Base64 into the decode panel to recover the original text. The two panels work independently, so you can flip between directions while debugging without clearing anything.

Many online Base64 tools garble non-Latin text because they skip proper UTF-8 handling. This tool uses a UTF-8-safe pipeline: Chinese characters, emoji, and rare symbols survive an encode-decode round trip intact, with none of the 中文-style mojibake.

  1. Encode: paste any text and the Base64 output appears immediately
  2. Decode: paste a Base64 string in the other panel to restore the original
  3. Cross-check: keep both panels side by side to compare encode and decode results in one view

All encoding and decoding happens locally in your browser — text never leaves your device, so payloads containing sensitive fields are safe to paste, and the tool keeps working offline.

>_ FAQ

Q1 · Why does my Chinese text turn into garbage after Base64 encoding?

The garbling comes from the tool, not from Base64 itself — it usually means the encoder did not process the text as UTF-8. This tool encodes strictly per UTF-8: encoding the two-character greeting "ni hao" here produces a string that any standards-compliant decoder restores character for character. Paste the result back and decode it once to verify.

Q2 · Is Base64 encryption?

No. Base64 is encoding, not encryption — it changes how data is represented, uses no key, and anyone can decode it instantly. Its real job is carrying binary data through text-only channels such as HTTP, JSON, and email. Never use it to protect passwords or secrets; for confidentiality you need a real encryption algorithm.

Q3 · Why does the encoded data get bigger?

Base64 represents every 3 bytes with 4 characters, so the size grows to about 4/3, or 133% of the original — the ratio holds for UTF-8 Chinese text as well, since each character takes 3 bytes. That is why Base64 suits small icons and short strings, not large files.

Q4 · What do the equal signs at the end of a Base64 string mean?

Base64 processes data in groups of 3 bytes. When the input length is not a multiple of 3, = or == pads the output to a multiple of 4 characters: one = means the last group had 2 bytes, two = means 1 byte, and no padding means the length divided evenly.

Q5 · Will + and / in a Base64 string break URLs?

Yes. In a URL query string, + is parsed as a space, and / and = have reserved meanings, so concatenating raw Base64 into a URL can corrupt it. The standard fixes are the URL-safe Base64 variant (replacing + with - and / with _) or a pass of percent-encoding first — and the receiver must apply the same rule to restore it. The encode panel here offers a "URL-safe" toggle (plus a 76-column wrap option for email protocols), and the decoder auto-detects and restores the URL-safe alphabet.

Q6 · Can I turn an image straight into a dataURL?

Yes. Drop an image or any file onto the encode panel (or click "Pick file") and the output shows both the raw Base64 and the full data:image/png;base64, dataURL, alongside an original-vs-encoded size comparison (e.g. 24 KB → 32 KB, +33%) so the inline-image cost is immediately visible. Files are capped at 10 MB — compress first if you exceed it. Pasting a dataURL-prefixed string into the decoder strips the prefix and restores the original content.

Embed code

Paste the code below into your page to embed this tool as an iframe (nav and footer auto-hidden).

Heightpx
This tool runs entirely in your browser — input never leaves your device. Press Ctrl K to switch tools anytime.