How to use the Base64 Encode / Decode
- Paste text or choose a file
- Click Encode or Decode
- Copy the result
Encode and decode Base64
Paste text and click Encode to Base64, or paste Base64 and click Decode from Base64. Text is handled as UTF-8, so accents, Arabic, Urdu and emoji survive the round trip. Tick URL-safe Base64 to use - and _ instead of + and /, as JWTs and URLs require. You can also drop any file to get it as a Base64 data URL.
Example
โHelloโ โ SGVsbG8=. Base64 turns every 3 bytes into 4 characters, so encoded data is about 33% larger. It is an encoding, not encryption: anyone can decode it, and there is no such thing as Base64 โwith a keyโ. Use real encryption for secrets.
In code and on the command line
- Python โ
base64.b64encode(s.encode()).decode()andbase64.b64decode(b).decode(). - JavaScript โ
btoa()andatob()only handle Latin-1, so encode UTF-8 withTextEncoderfirst; in Node.js,Buffer.from(s).toString('base64'). - Java 8+ โ
Base64.getEncoder().encodeToString(bytes)andBase64.getDecoder().decode(s). - PHP โ
base64_encode()andbase64_decode(). - Linux and macOS terminal โ
base64 file.txtto encode,base64 -dto decode. - C and C++ โ there's no standard function; use a library such as OpenSSL's
EVP_EncodeBlock. - Notepad++ โ Plugins โ MIME Tools โ Base64 Encode / Decode.