Base64 Encoder Decoder
Encode text to Base64 or decode Base64 back to text, with URL-safe alphabet, padding, MIME line wrapping and UTF-8 support.
Tool guide
What this tool does
Base64 Encoder Decoder converts text to the RFC 4648 Base64 format and back. It handles UTF-8, Latin-1 and UTF-16LE text correctly, supports the URL-safe alphabet used in JWTs, and can wrap output at 76 or 64 characters for email and PEM files.
Base64 turns arbitrary bytes into 64 printable ASCII characters so that binary data can travel through systems built for text: email bodies, JSON fields, HTTP headers, data URIs and configuration files. Every 3 input bytes become 4 output characters, which is why encoded data is about 33% larger than the original. Decoding by hand is impractical, and the browser function btoa() fails on any character outside Latin-1, such as “é” in UTF-8 or an emoji.
This tool first converts your text to bytes in the character set you choose (UTF-8 by default), then applies the RFC 4648 alphabet. You can switch to the URL-safe variant, which replaces “+” and “/” with “-” and “_”, drop the “=” padding, and wrap lines at 76 characters as MIME requires. The decoder accepts both alphabets, ignores whitespace and line breaks, strips a data: prefix, and tells you exactly which character is invalid. All processing happens locally in your browser.
How to use Base64 Encoder Decoder
- Type or paste your text into the Input box, or open a text file.
- Choose Encode or Decode under Mode in the Options panel.
- Pick the character set: UTF-8 suits almost all modern text; choose Latin-1 or UTF-16LE only when a legacy system expects it.
- For encoding, select the alphabet, padding and line length you need.
- Copy or download the result, or press “Use output as input” to reverse the operation and check the round trip.
Tips for better results
- Use the URL-safe alphabet without padding for JWT segments, URL parameters and file names.
- Base64 output length is always 4 × ceil(n / 3) characters with padding, so 10 bytes become 16 characters.
- If decoded text shows odd characters such as “é”, the original was probably UTF-8 decoded as Latin-1; switch the character set.
- To turn Base64 into an image, PDF or other binary file, use Base64 to File instead of decoding to text.
Common use cases
- Reading the payload of a Basic authentication header (username:password).
- Preparing a value for a Kubernetes Secret, which stores data as Base64.
- Inspecting an email body sent with Content-Transfer-Encoding: base64.
- Encoding a JSON string so it can be passed safely as a single URL parameter.
Common mistakes to avoid
- Treating Base64 as encryption. Anyone can decode it instantly, so never use it to protect passwords or keys.
- Mixing alphabets: a Base64url string decoded by a strict standard decoder may fail on “-” and “_”. This tool accepts both.
- Removing padding when the receiving system requires it. Some older libraries reject strings whose length is not a multiple of 4.
- Copying a value with a trailing newline into a configuration file, which changes the encoded result.
Frequently asked questions
Why does Base64 make my data bigger?
Each Base64 character carries 6 bits, so 3 bytes (24 bits) need 4 characters. Encoded output is roughly 133% of the input size, plus line breaks if you wrap it for MIME.
What is the difference between Base64 and Base64url?
Base64url, defined in section 5 of RFC 4648, swaps “+” for “-” and “/” for “_” so the result is safe in URLs and file names. It is usually written without “=” padding, as in JSON Web Tokens.
Can I decode Base64 that contains line breaks?
Yes. Spaces, tabs and line breaks are ignored when decoding, so MIME-wrapped email content and PEM-style blocks decode correctly.
Is my text uploaded anywhere?
No. Encoding and decoding run entirely in your browser using built-in JavaScript functions, so the text never leaves your device.
Feedback & suggestions
Help us improve Base64 Encoder Decoder. We read every message.