Skip to content
Developer guides

How to Base64 encode and decode text, files and data URLs

Published 3 min read

Base64 turns any data, such as text or a picture, into plain letters and digits that can travel safely through systems built for text. To Base64 encode or decode something without installing anything, use Convertada's Base64 Encoder / Decoder. It runs entirely in your browser: nothing is uploaded or stored.

What Base64 is, and what it is not

Base64 represents bytes using 64 characters: A to Z, a to z, 0 to 9, plus + and /. It is used in email attachments, data URLs inside web pages, tokens and many configuration files.

It is not encryption. Anyone can decode Base64, so never treat it as a way to hide a password or private data.

What the tool does

  • Encodes text, with full UTF-8 support, so accented letters, emoji and non-Latin scripts work.
  • Decodes Base64 back to text, or to a file when the result is not text.
  • Converts a file to Base64.
  • Offers URL-safe output, which uses - and _ instead of + and /.
  • Can wrap lines at a chosen length (76 or 64 characters, or no wrapping).
  • Can add a data URL prefix when you encode a file.
  • Lets you copy the result, swap input and output, clear both and download the result as a TXT file.

Step-by-step: encode text

  1. Open the Base64 Encoder / Decoder.
  2. Type or paste your text in the input box.
  3. Choose options: URL-safe if the result will go into a web address or filename, and a Line length if a system needs wrapped lines.
  4. Select Encode.
  5. Use Copy, or Download TXT.

Step-by-step: decode Base64

  1. Paste the Base64 text into the input box. A data URL starting with data: also works.
  2. Select Decode.
  3. If the decoded data is text, it appears in the result. If it is not UTF-8 text, the tool tells you its size and offers a file download instead.

Step-by-step: convert a file to Base64

  1. Choose File to Base64 and select your file.
  2. Tick Add data URL prefix if you want something you can paste into a web page, for example as an image source.
  3. Copy the result or download it as a TXT file.

Limits to know about

  • Text input can be up to 20 MB of characters, and a file can be up to 15 MB.
  • Very long results are shown only in part in the result box, with a message, but Copy and Download use the full result.
  • Base64 makes data about a third larger, so a big file becomes a much bigger text.
  • A data URL is practical for tiny images, but a large one makes a page heavy. If you need a smaller image first, use Compress Image or Resize Image.

Common problems and how to fix them

"Invalid Base64: character not allowed." The message shows the character and its position. Remove spaces or characters that are not part of Base64, or tick URL-safe if the text uses - and _.

"The length is not valid." One character is missing or extra, usually from a cut-and-paste.

"The padding is misplaced." The = sign may only appear at the end, at most twice.

The decoded text looks like nonsense. The data may be a file or another encoding, not text.

Frequently asked questions

Is Base64 encryption?

No. It is an encoding that anyone can reverse.

Is my data sent to a server?

No. The tool runs in your browser.

What is URL-safe Base64?

A variant that swaps + and / for - and _ so the result is safe inside web addresses and filenames.

Why is the result longer than the original?

Base64 uses four characters for every three bytes, so it is about a third bigger.

Conclusion

Use Encode for text and files, Decode for the way back, and choose URL-safe or a data URL when your use case needs it. Remember that it is for compatibility, not for secrecy.