Skip to content
cliplimeClipLime

Encode and decode Base64

Text, files and images to Base64 and back, with correct UTF-8 handling.

Your text and files stay in your browser

Any language and emoji work. The text is turned into bytes first, then into Base64.

0 characters, 0 lines

UTF-8 is right unless you know a system needs something else.

Options

Writes - and _ instead of + and /, so the result is safe in URLs, file names and JWTs.

Standard Base64 pads to a multiple of 4 characters with =. Turn it off for the shorter form many APIs expect.

Break the result into lines. 76 is what email (MIME) uses, 64 is what PEM files use.

Adds data:type;base64, in front, so the result can go straight into an img tag or a CSS url().

At a glance

What it does
Turns text, files and images into Base64, and Base64 back into text, files and images.
Text
Any language and emoji work, because text is converted to UTF-8 first. UTF-16 (for PowerShell) and Latin-1 are also offered.
Alphabets
Standard (+ and /) and URL-safe (- and _), with or without the = padding. Decoding accepts either.
Layout
One long line, or lines of 64 (PEM) or 76 (MIME) characters.
Files
Any file up to 50 MB, with an optional data URL prefix. Decoded files are saved with the right extension, found from the bytes.
Privacy
Everything happens in your browser. Your text and files are never uploaded.
Price
Free, no sign-up.

How to do it

  1. 1

    Pick a view

    Choose Encode, Decode, Image to Base64 or Base64 to image at the top of the tool.

  2. 2

    Paste or choose

    Type or paste text, or choose a file. The result updates as you type, with nothing to submit.

  3. 3

    Set the options

    Turn on the URL-safe alphabet, drop the = padding or wrap lines at 64 or 76 characters if the place you will use the result needs that.

  4. 4

    Copy or download

    Copy the result, or download it as a text file. When decoding, download the original file.

What Base64 is for

Base64 writes any data, including images and other binary files, using only 64 safe characters: A to Z, a to z, 0 to 9, + and /. It takes 3 bytes at a time and writes them as 4 characters, so the result is about a third larger than the original.

That makes it useful wherever a system only carries plain text: email attachments (MIME), data URLs in HTML and CSS, binary values inside JSON or XML, HTTP Basic authentication headers, and the three parts of a JWT.

Base64 is an encoding, not encryption. Anyone can turn it back into the original with no key, so never use it to hide a password or a secret.

Why text with accents or emoji needs UTF-8

Base64 works on bytes, not on letters. Before text can be encoded, it has to be turned into bytes, and the choice of encoding changes the result. The browser function btoa() only understands the first 256 characters (Latin-1) and throws an error on anything else, such as a Chinese character or an emoji.

This tool converts text to UTF-8 bytes first and then encodes those, which is what almost every modern system expects. When you decode, the bytes are read as UTF-8 again, so Héllo 你好 👋 survives the round trip.

If the other side used a different encoding, you can say so. PowerShell's -EncodedCommand expects Base64 of UTF-16 little endian text, and some older systems use Latin-1.

Standard and URL-safe Base64

Standard Base64 uses + and /, and both have special meanings in URLs and file names. The URL-safe form from RFC 4648 swaps them for - and _, and often leaves off the = padding. JWTs, many API tokens and file-name-safe identifiers use it.

A decoder that expects one alphabet can reject the other. The Decode view here reads both and tells you which one it found, so you do not have to guess.

Questions people ask

Is Base64 a form of encryption?

No. Base64 only changes how data is written. Anyone can decode it without a key, so it gives no protection. Use real encryption if the data is secret.

Why does Base64 text end with = or ==?

Base64 works in groups of 3 bytes. When the last group has only 1 or 2 bytes, one or two = characters pad the output to a multiple of 4 characters. Some systems leave the padding off, and the decoder here accepts it either way.

Why is the Base64 about 33% bigger than the original?

Every 3 bytes (24 bits) are written as 4 characters of 6 bits each, so the text is 4/3 the size of the data, plus a little for padding and any line breaks.

Why does decoding fail on a string from a URL or a JWT?

Those use the URL-safe alphabet, with - and _ and usually no padding. Many decoders only accept the standard alphabet. The Decode view here accepts both.

Is my text or file sent to a server?

No. The conversion runs in your browser tab, and your text and files are not sent over the network or stored.

How big a file can I convert?

Up to 50 MB. The browser has to hold the file and the Base64 text in memory at the same time, so very large files are better handled with a command line tool.