DEVELOPER TOOL

Base64 Encoder & Decoder

Encode and decode text locally.

About Base64 Encoder & Decoder

Base64 turns arbitrary bytes into a limited alphabet of letters, digits, plus and slash so the data can travel through systems built for plain text. You meet it in email attachments, data URIs, HTTP Basic authentication headers, configuration files, and the segments of a JWT. This page gives you two buttons, Encode and Decode, and a single text box for the input.

Text is converted to UTF-8 bytes before encoding, and decoded bytes are read back as UTF-8. That matters because the browser's built-in btoa function only handles Latin-1 characters and throws an error on anything else. Here, a word like cafe with an accent, a Japanese sentence, or an emoji encodes and decodes correctly instead of failing.

Keep one thing in mind: Base64 is a representation, not a protection. Anyone can reverse it in a second, so it should never be used to hide passwords or tokens. It also makes data roughly one third larger, which is the price of using only safe characters.

How to use Base64 Encoder & Decoder

  1. Click into the large text box and paste or type your input, either plain text you want to encode or a Base64 string you want to read.
  2. Press the Encode button to convert the text to Base64, or press Decode if the box holds a Base64 string.
  3. Read the output that appears in the result area below the buttons. Select it and copy it with your normal copy shortcut.
  4. If you see Invalid Base64, check for stray characters, a truncated string, or the URL-safe variant, then clean the input and press Decode again.

When this tool helps

Reading an encoded config value

A Kubernetes secret, an environment file, or an API response contains a long string ending in an equals sign. Paste it, press Decode, and see whether it holds readable text such as a connection string or JSON before you decide how to handle it.

Building a Basic auth header

HTTP Basic authentication sends username:password as Base64. Type the pair with a colon between them, press Encode, and add the result after the word Basic in your header when testing an endpoint with a command-line client.

Checking what an email or data URI contains

Text parts of a MIME message and small inline data URIs are often Base64. Paste only the encoded portion without headers or the data:text/plain;base64 prefix, and Decode will show the original text if it was UTF-8.

Making text safe to embed

When you need to place multi-line text or special characters into a JSON field, a query string, or a script that mangles quotes and line breaks, encoding it first gives you one clean line of safe characters.

Tips for better results

  • Remove any prefix before decoding. A data URI such as data:image/png;base64, or a header word like Basic is not part of the encoded data and will cause an error.
  • If your string contains hyphens and underscores instead of plus and slash, it is the URL-safe variant used in JWTs. Swap hyphens for plus and underscores for slash first, since this tool expects the standard alphabet.
  • Decoding text that was never UTF-8, such as a compressed file or an image, produces garbled characters. That is expected, because the result is binary data being displayed as text.
  • Do not paste real passwords or private keys into any web page unless you must. Encoding them does not add security, and the decoded value is just as sensitive as the original.

Good to know

  • The tool works with text only. It cannot encode a file or image into Base64, and decoded binary content cannot be saved from here.
  • Only the standard Base64 alphabet is expected. URL-safe strings and strings with broken padding may be rejected with an Invalid Base64 message.
  • Decoding assumes the underlying bytes are UTF-8 text, so output from other character encodings may appear with replacement characters.

Privacy and your data

Encoding and decoding run in your browser using standard built-in functions. The text you enter is not sent to a server by this tool.

Base64 Encoder & Decoder FAQ

Is Base64 encryption?

No. Base64 is a reversible encoding with no key and no secret, so anyone who sees the string can decode it instantly. It exists to make binary or special-character data safe to transmit as plain text. If you need confidentiality, use real encryption, and treat Base64 output as if it were the original data.

Why does my Base64 string end with one or two equals signs?

Base64 works in groups of three bytes that become four characters. When the input length is not a multiple of three, the output is padded with one or two equals signs so the total length stays a multiple of four. The padding carries no data of its own.

Why does the encoded output look longer than my input?

Every three bytes of input become four characters of output, so the result is about one third larger. Non-ASCII characters add more, because an accented letter takes two UTF-8 bytes and many emoji take four before encoding begins.

Why do I get Invalid Base64 when decoding?

The usual causes are a copied prefix, extra quotation marks, a string cut off in the middle, or characters outside the standard alphabet such as hyphens and underscores from the URL-safe variant. Trim the string to just the encoded characters and try again.

Can I decode a Base64 image or PDF here?

Not in a useful way. The tool shows the decoded bytes as text, which is meaningless for images, PDFs, and other binary files. It is meant for readable text such as JSON, credentials in test setups, and configuration values.

Does it handle accents, Chinese characters and emoji?

Yes. Input is converted to UTF-8 before encoding and read back as UTF-8 when decoding, so non-English text round-trips correctly. Be aware that other tools which assume Latin-1 may produce a different Base64 string for the same text.

Browse all ELDOSA tools →