Skip to content

Free online calculators, converters, generators, and useful tools to simplify everyday tasks. Fast, accurate, easy to use, and accessible on any device.

Base64 Encoder / Decoder – Free Online Tool

All encoding and decoding happens entirely in your browser. No data is sent to a server. The tool supports full UTF-8 characters, including emojis and international text.

What Is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It is widely used in computing, from embedding images directly into HTML or CSS files to transmitting email attachments and handling API authentication tokens. By converting data into a set of 64 safe characters, Base64 ensures that information can be transmitted over media that are designed to deal with textual data without corruption.

This free online tool allows you to instantly encode plain text into Base64, or decode a Base64 string back into readable text. Whether you are a developer debugging a JSON Web Token (JWT), trying to read an encoded email header, or just curious about how Base64 looks, this tool provides a fast, secure, and private solution.

How to Use This Base64 Tool

  1. Choose your mode. At the top of the tool, select either "Encode to Base64" or "Decode from Base64". The tool will update your input accordingly.
  2. Enter your text. Paste your raw text or Base64 string into the "Input" box on the left. The tool will automatically process it as you type.
  3. Read the result. The "Output" box on the right will instantly display the converted text.
  4. Handle errors. If you are decoding and the input contains invalid Base64 characters, the input box will turn red and an error message will explain exactly what went wrong.
  5. Copy or clear. Click "Copy Result" to save the output to your clipboard, or "Clear All" to start over with a clean slate.

The Math Behind Base64

Base64 encoding does not encrypt data; it simply changes how the data is represented. It works by breaking the input into chunks of 3 bytes (24 bits) and splitting those 24 bits into four 6-bit groups.

The Character Set: Each 6-bit group can represent a value from 0 to 63. These values are mapped to the following 64 characters:

  • A-Z (values 0-25)
  • a-z (values 26-51)
  • 0-9 (values 52-61)
  • + (value 62)
  • / (value 63)

Padding: If the input length is not divisible by 3, the output is padded with the equals sign (=) to ensure the output length is always a multiple of 4. One = means the input was 1 byte short of a multiple of 3, and two == means it was 2 bytes short.

Important note on Unicode. The native JavaScript btoa() function fails on characters outside the Latin1 range (like emojis or Chinese text). This tool uses the TextEncoder API to convert strings to UTF-8 byte arrays before encoding, ensuring that all international characters are handled perfectly.

Base64 Character Set at a Glance

Here is a quick reference for how Base64 maps binary data to text.

DecimalCharacterDecimalCharacter
0 - 25A - Z32 - 51g - z
26 - 51a - z52 - 610 - 9
62+63/
Padding=

Worked Examples

Example 1: Encoding a simple string

Input: "Hello"
Action: Encode to Base64.
Output: SGVsbG8=
The word "Hello" is 5 bytes. The encoder pads the end with a single = to make the output length a multiple of 4.

Example 2: Decoding a Base64 string

Input: SGVsbG8gV29ybGQ=
Action: Decode from Base64.
Output: "Hello World"
Notice the = at the end, indicating padding.

Example 3: Handling UTF-8 Characters

Input: "Café ☕"
Action: Encode to Base64.
Output: Q2Fmw6kg4piV
If you used a basic encoder that ignores UTF-8, this would throw an error. This tool handles the accent and emoji perfectly.

Five Base64 Mistakes Developers Make

  1. Assuming Base64 is encryption. Base64 is an encoding scheme, not an encryption method. It provides zero security. Anyone can decode a Base64 string instantly. Never use Base64 to "hide" passwords or sensitive data.
  2. Not using URL-safe Base64. Standard Base64 uses + and /, which have special meanings in URLs. If you are using Base64 in a URL or filename, you must use "URL-safe Base64" (which replaces + with - and / with _).
  3. Forgetting about character encoding. Before encoding, you must know the character encoding of your text (usually UTF-8). If you encode a string with the wrong encoding, the decoded output will be garbled.
  4. Ignoring padding. Some decoders require the padding (=) to be present, while others can handle missing padding. If your decoded string is failing, check if the padding was stripped by a system (like a URL router).
  5. Encoding large files in memory. Base64 increases the size of the data by approximately 33%. Encoding very large files (like a 1GB video) in a browser can cause the tab to crash due to memory limits.

Frequently Asked Questions

Is Base64 encryption?

No. Base64 is an encoding format, not encryption. It does not require a key and does not secure your data. It only converts data into a format that is safe for text-based systems.

Why does Base64 sometimes have equals signs (=) at the end?

The equals signs are padding. Base64 encodes data in blocks of 3 bytes, resulting in 4 characters. If the input data is not a perfect multiple of 3 bytes, the encoder adds one or two = signs to fill the remaining space.

Can I use this tool to decode JWT tokens?

Yes. JSON Web Tokens (JWTs) consist of three Base64URL-encoded parts separated by dots. You can paste the middle section (the payload) into this tool to read the JSON data inside.

Why did my Base64 output break a URL?

Standard Base64 uses the + and / characters, which are reserved in URLs. If you need to put Base64 in a URL, use Base64URL encoding, which replaces + with - and / with _.

Does Base64 make files smaller?

No. Base64 actually increases the size of the data by about 33%. It is used to ensure compatibility with text-based protocols, not for file compression.

Is my data secure when using this tool?

Yes. The encoding and decoding are done entirely in your browser using JavaScript. Your data never leaves your computer and is not sent to any server.

What is the difference between Base64 and Hexadecimal?

Hexadecimal (Base16) uses 16 characters (0-9 and A-F) and increases data size by 100%. Base64 uses 64 characters and increases data size by 33%, making it more efficient for transmitting binary data in text format.

Can I decode Base64 that I found in an image?

If the image is a Data URI (a string starting with data:image/png;base64,...), you can copy the part after the comma and paste it here to decode it back to text, though it will likely appear as binary data unless it is a text file encoded as an image.

Related Calculators

AdSense Placeholder – After Tool Introduction