Base64 encode text online

Encode and decode Base64, URLs and HTML entities. Handles emoji.

You usually need Base64 encoding when a system expects plain text but you have something else: a username and password for a basic authorization header, a short JSON payload for a query parameter, a small icon to place inside a stylesheet, or a value for a config file. This page opens on the Base64 tab in encode mode, so you can paste and copy straight away. The text is turned into UTF-8 bytes before encoding, which matters for anything beyond English letters. The text héllo ✓, with an accent and a check mark, gives aMOpbGxvIOKckw==, and an emoji works as well, where the browser's btoa function would fail. Tick URL-safe when the result goes into a web address, a file name or a web token, because it swaps + and / for - and _ and drops the = at the end. To embed a picture, choose a file of up to 5 MB and copy the data URI. This page encodes to Base64 only; it is not encryption, and anyone can decode the result.

How it works

  1. Paste your text
  2. Choose encode or decode
  3. Copy the result

Frequently asked questions

How do I Base64 encode a username and password for a header?

Type them as user:password, with a colon, and copy the result. For example Aladdin:open sesame gives QWxhZGRpbjpvcGVuIHNlc2FtZQ==. Basic authorization then adds the word Basic and a space in front of it.

Why does the encoded text end with = or ==?

Base64 writes 3 bytes as 4 characters. When the input is not a multiple of 3 bytes, one or two = signs fill the last group, so Hello (5 bytes) ends with a single = and Hi! ends with none. URL-safe mode removes them.

Can I encode an image or a PDF here?

Yes, up to 5 MB, as a data URI that starts with data:image/png;base64, for a PNG. Choose the file under the text box. It is read in this tab and not uploaded. Turning Base64 back into a file is not offered.