Home » Developer Tools » Base64 Encoder / Decoder

Base64 Encoder and Decoder

Encode any text to Base64 or decode Base64 back to readable text - instant and free.

Last updated 13 November 2026

BotixTech's free Base64 encoder decoder converts text to Base64 and back in one click. Developers use Base64 to embed images in code, encode API credentials, and safely transmit binary data as text.

Paste your text, hit encode - or paste a Base64 string and hit decode. Our Base64 converter handles UTF-8 correctly, so emoji and non-English text work too.

How to Encode and Decode Base64

  1. Paste your input - plain text to encode, or a Base64 string to decode.
  2. Choose encode or decode - one click does the conversion.
  3. Copy the result - use the copy button to grab the output.

Base64 Tool Features

What Is Base64 Encoding

Base64 encoding is a way to turn binary data into plain text. It takes any bytes, whether they come from text, an image, or a file, and rewrites them using only 64 safe characters: capital and small letters, digits, a plus sign, and a slash. The result is ordinary text that can travel through systems built for text only, such as email, JSON, and web addresses.

The name says what it does. Base64 uses 64 characters because 64 is 2 to the power of 6, so each character carries exactly 6 bits of data. That is why it is called Base64, and why the output is always made of those 64 characters plus an equals sign used as padding at the end.

How Base64 Works

Base64 works in small groups. It takes the input bytes three at a time, which is 24 bits, and splits those 24 bits into four groups of 6 bits. Each 6 bit group becomes one character from the 64 character alphabet. Three bytes in always become four characters out, so the output is one third larger than the input, about 33 percent, before padding.

When the input length is not a multiple of three, the encoder adds padding. One missing byte becomes one equals sign, and two missing bytes become two equals signs. The decoder reads the padding and knows exactly how many bytes to return, so the round trip is exact. This tool handles that padding for you, but only for standard Base64, not for the URL safe variant.

Worked Examples

These examples were run through the tool on this page, with the exact byte counts:

TextBytes in UTF-8Base64 output
Hello5SGVsbG8=
Hello World11SGVsbG8gV29ybGQ=
Base646QmFzZTY0
😀48J+YgA==

Short inputs show the padding effect clearly. The 6 byte word Base64 becomes the 8 character string QmFzZTY0, exactly one third larger. The emoji is 4 bytes in UTF-8 and becomes 8 characters, because the first three bytes make four characters and the one byte left over makes two characters plus two padding signs. For longer text the overhead settles at about 33 percent.

Encode and Decode Base64 in Code

You do not need a website to use Base64. Every common language has it built in. The short samples below do the same job as this tool, and they show why the tool needs the extra UTF-8 step in JavaScript.

JavaScript:

// Encode
const bytes = new TextEncoder().encode("Hello World");
let binary = "";
bytes.forEach(b => binary += String.fromCharCode(b));
const encoded = btoa(binary); // SGVsbG8gV29ybGQ=

// Decode
const raw = atob(encoded);
const out = new TextDecoder().decode(Uint8Array.from(raw, c => c.charCodeAt(0)));

Python:

import base64
encoded = base64.b64encode("Hello World".encode("utf-8"))
print(encoded.decode("ascii"))  # SGVsbG8gV29ybGQ=
decoded = base64.b64decode(encoded).decode("utf-8")
print(decoded)  # Hello World

Command line:

echo -n "Hello World" | base64
# SGVsbG8gV29ybGQ=
echo "SGVsbG8gV29ybGQ=" | base64 -d
# Hello World

The JavaScript sample shows the catch: btoa and atob only understand single byte characters, so text must pass through TextEncoder and TextDecoder first. Python and the command line handle UTF-8 for you, which is why their samples are shorter.

Where Base64 Is Used

Base64 shows up wherever binary data must travel as text. Email attachments use it in MIME messages, web pages embed small images as data URIs, and APIs send binary tokens inside JSON, which cannot hold raw bytes. It is also how HTTP Basic Auth sends a username and password, as one Base64 string after the word Basic.

You will also meet it in web tokens. A JWT is three URL safe Base64 segments joined by dots, and each segment is a piece of JSON. Because this tool accepts standard Base64 only, use the JWT Decoder on this site to read a token. For a different kind of text encoding, the Text to Binary Converter turns text into ones and zeros instead.

What This Tool Cannot Do Yet

This tool is honest about its limits. It converts text only, so there is no file upload and no way to encode an image. It accepts standard Base64 only, so URL safe input with a dash or an underscore is rejected, and it has no live mode, so you must click Encode or Decode after each change. There is also no download button, so the result stays in the result box until you copy it.

Those limits are on the list for a future rebuild, starting with a URL safe mode and file support. Until then, this page covers the text job well: both directions, correct UTF-8 handling for emoji and non English text, and a copy button that puts the result on your clipboard in one click.

Frequently Asked Questions

What is Base64 encoding?

Base64 is a way to represent binary data using 64 text characters (A-Z, a-z, 0-9, +, /). It lets you safely include images or binary data inside text formats like JSON, HTML and URLs.

Is Base64 encryption?

No. Base64 is encoding, not encryption - anyone can decode it instantly. Never use it to protect passwords or secrets.

Why is my Base64 string so long?

Base64 output is about 33% larger than the input. That overhead is the price of making binary data text-safe.

Can I decode any Base64 string here?

Yes, as long as it is standard Base64 text. URL safe Base64 uses a dash and an underscore in place of two standard characters, and this tool does not accept those characters yet. A data URI prefix is not accepted either. The tool shows an error if the input cannot be decoded.

What is URL safe Base64?

URL safe Base64 is a variant that swaps two characters so the output can sit safely in a web address. Standard Base64 uses a plus sign and a slash, which have special meanings in URLs, so the URL safe variant uses a dash and an underscore instead and usually drops the equals padding. This tool accepts standard Base64 only for now, so URL safe input is rejected until that mode is added.

Can I encode a file or an image here?

No. This tool converts text only. It has no file upload, so you cannot drop in an image or a document to encode it. The text you paste is converted in your browser, and the result is text you can copy.

Is my text uploaded anywhere?

No. Encoding and decoding happen entirely in your browser. Your text is never sent to a server, stored, or logged, so you can safely convert text from a private project.

Why does decoding fail with an error?

Decoding fails when the input is not valid standard Base64. Common causes are a missing equals sign at the end, a space or line break inside the string, URL safe characters, or a data URI prefix pasted along with the code. Remove the extra characters, fix the padding, and try again.

How do I decode one part of a JWT?

A JWT is three URL safe Base64 segments joined by dots, holding the header, the payload, and the signature. Because this tool accepts standard Base64 only, a segment that contains a dash or an underscore will fail here. Use the JWT Decoder tool on this site instead, it reads the header and payload for you.