Online Base64 Encode / Decode Tool

Base64 encode / decode / Base64URL / atob & btoa / UTF-8 & Chinese support

Input
Output

What is Base64?

Base64 is an encoding scheme that turns binary data into ASCII strings, using 64 printable characters (A-Z, a-z, 0-9, +, /). Every 3 raw bytes become 4 Base64 characters (about 33% larger in size). In JavaScript you decode with atob() and encode with btoa(); this tool uses the same API underneath with built-in UTF-8 byte handling so Chinese and other non-ASCII text encode and decode correctly. To convert an image to Base64, use the Image to Base64 tool; if the decoded result is JSON, tidy it up with JSON Formatter.

Common Base64 use cases

  • JWT Token parsing: the Header and Payload of a JWT are Base64URL-encoded — paste and decode them here to read the contents.
  • API data transfer: when passing binary data inside JSON, encode it as Base64 first, then inspect the overall structure with the JSON Formatter.
  • MIME email attachments: email protocols only carry text, so attachments are Base64-encoded and embedded in the message body.
  • Data URI embedding: embed small icons in HTML/CSS as data:image/png;base64,... to cut HTTP requests (see Image to Base64).
  • URL-safe transfer: the + and / of standard Base64 have special meanings in URLs, which led to Base64URL (replacing +/ with -_ and dropping trailing =).

FAQ

What is the difference between Base64 and Base64URL?

Base64URL is the URL-safe variant of standard Base64: + becomes -, / becomes _, and the trailing = padding is omitted. The Header and Payload of a JWT use Base64URL encoding.

Why does atob() garble Chinese text when decoding?

The native atob() only handles Latin1 characters and cannot directly decode UTF-8 Chinese. First get the binary string with atob(), then decode it with TextDecoder in UTF-8. This tool wraps that logic, so Chinese decodes correctly out of the box.

Why do Base64 strings sometimes end with =?

Base64 encodes every 3 bytes into 4 characters. When the byte count is not a multiple of 3, = padding fills it up to a multiple of 4: 1 remainder byte gets two =, 2 remainder bytes get one =. Decoders ignore this padding automatically.

Is Base64 encryption?

No. Base64 is an encoding scheme, not encryption — there is no key involved and anyone can reverse it with a simple decoder. For real protection, use a symmetric encryption tool.