Tech News, Tech & Coding · Free Online Tools

IT Question Answer
Tools
0110

Base64 Encoder & Decoder

Convert text and files to and from Base64 encoding instantly.

Advertisement

What Base64 is for

Base64 turns binary data into plain text made of letters, digits, + and /, so it can travel through systems that only handle text, such as JSON, email bodies, HTML data URIs and HTTP headers. It is an encoding, not encryption: anyone can reverse it, so never use it to hide secrets.

This tool encodes and decodes in your browser. Your text and files are not uploaded.

How to use it

Paste text and choose Encode to get the Base64 string, or paste a Base64 string and choose Decode to read the original. You can also work with files. Turn on URL-safe mode when the result will go into a URL or a JWT.

Example

Encoding the text Hello, World! gives:

Hello, World!  →  SGVsbG8sIFdvcmxkIQ==

URL-safe form replaces + with - and / with _, and often drops the = padding.

Common Base64 problems

  • Garbled characters after decoding: the original text was UTF-8 but was decoded as Latin-1. Make sure UTF-8 is used on both sides.
  • Invalid string errors: stray spaces or line breaks, or a URL-safe string decoded as standard Base64 (or the reverse).
  • Missing padding: some systems drop the trailing = characters. Standard decoders may need them added back.
  • Larger output: Base64 makes data about one third bigger, so avoid it for large files when you can send raw bytes.

Where Base64 is used

Base64 turns binary data into plain text, which is why it appears in so many places:

  • Data URLs, such as small images embedded in HTML or CSS.
  • Email attachments, which travel as Base64 text inside the message.
  • JSON Web Tokens, where the header and payload are Base64URL encoded.
  • HTTP Basic authentication, where username and password are joined and Base64 encoded.
  • Storing small binary values in JSON or XML, which cannot hold raw bytes.

Base64 is not encryption

Anyone can decode Base64 in a second, so it hides nothing. It only changes how data is written. Never use it to protect passwords, keys or personal data. If you need secrecy, encrypt first with a tool such as AES and then Base64 encode the encrypted result so it can travel as text. Base64 also makes data about 33 percent larger, so it is a poor choice for big files.

Related tools

Advertisement

Frequently asked questions

No. Base64 is a reversible encoding. Anyone can decode it, so it provides no security.

A variant that swaps + and / for - and _ so the string can be used in URLs and tokens without percent-encoding.

Usually a character-encoding mismatch. Decode the bytes as UTF-8 if the original text was UTF-8.

The = characters are padding so the output length is a multiple of four.

Yes, you can load a file and get its Base64 text. Large files produce long strings.