Base64 encode

Convert text to Base64 instantly. Accented letters, other alphabets and emoji are encoded correctly as UTF-8, and you can switch to URL safe output for tokens and addresses.

Free and private. Everything runs in your browser, nothing is uploaded.

How it works

  1. Paste your textType or paste into the input box, or open a text file. Sample shows an example.
  2. Check the resultThe result appears on the right as you type. Errors are shown with the line and column.
  3. Copy or swapCopy the result, download it as a file, or press Swap to reverse the direction and check it.

When to encode text as Base64

Base64 is used to put text or binary data where only simple characters are allowed: HTTP Basic authentication headers, JSON fields, email attachments, environment variables and data URIs.

Turn on 76 character lines for email and PEM style output. Turn on URL safe output when the result goes into a web address or a JWT token.

How much bigger the Base64 output gets

Base64 writes every 3 bytes as 4 characters, so plain English text grows by about a third. The word Hello is 5 bytes and becomes SGVsbG8=, which is 8 characters. When the byte count is not a multiple of 3, the end is filled with one or two = signs.

Accented letters and other alphabets take 2 to 4 bytes each in UTF-8, so the same number of characters produces a longer result than English text does. The status line under the result shows both sizes and the exact increase. If you turn on 76 character lines, the line breaks add a little more on top. For long data in a size limited field, such as a cookie or a URL, check this number before you paste it.

About Base64

Base64 writes binary data using 64 safe characters: A to Z, a to z, 0 to 9, + and /. Every 3 bytes become 4 characters, so the result is about a third larger than the original.

Frequently asked questions

How do I make a Basic authentication header?

Encode username:password and put Basic and a space in front of the result. Remember that this is not encryption, so always use HTTPS.

Why does my Base64 end with = or ==?

That is padding. One = means the last group held 2 bytes, == means it held 1 byte. URL safe output leaves the padding out, and decoders, including this one, accept both.

Can I encode an image or a PDF to Base64 here?

This page encodes text. If you open a file that is not text, it asks you to use the Image to Base64 tool, which accepts images and other files and can write a ready data URI.

Is my text uploaded anywhere?

No. Encoding and decoding happen in your browser. Tokens, keys and other private text never leave your device.

Is Base64 encryption?

No. Base64 only changes how data is written. Anyone can decode it, so never use it to protect passwords or secrets.

What is URL safe Base64?

It replaces + and / with - and _ and drops the = padding, so the result can be used in addresses and file names. It is used in JWT tokens, for example. The decoder accepts both forms.

Why does decoding show a file instead of text?

If the decoded data is not readable text, the tool checks what kind of file it is. Images are previewed, and any file can be downloaded with the Download button.

Does it work offline?

Yes. After you open the page once, it keeps working without an internet connection.