Base64 encode text or decode Base64 back to text, UTF-8 safe and fully in your browser.
Everything runs on your device and nothing is uploaded. Base64 is an encoding, not encryption: anyone can decode it, so never rely on it to hide passwords or personal data.
This tool lets you base64 encode any text, or decode a Base64 string back into readable text, straight in your browser. It handles UTF-8 properly, so accents, the £ sign and emoji survive the round trip, and it supports the URL safe alphabet from the Base64 standard described on MDN, optional padding and 76 character line wrapping. Nothing you paste ever leaves your device.
Quick answer: To base64 encode text, turn it into UTF-8 bytes, split the bytes into groups of 3 and map each group to 4 characters from A to Z, a to z, 0 to 9, + and /. "Hello" becomes SGVsbG8=. To decode, reverse the steps. The output is always about 33% larger than the input.

In This Guide
What Is Base64 Encoding?
Base64 is a way of writing any binary data using only 64 safe text characters, so it can travel through systems that were built for plain text, such as email, JSON, URLs and HTML. It is defined in RFC 4648 and used in data URIs, email attachments, JSON Web Tokens and HTTP Basic authentication.
The method is simple: every 3 bytes (24 bits) become 4 characters of 6 bits each. Each 6 bit value from 0 to 63 picks a character from the alphabet A to Z, a to z, 0 to 9, + and /. When the input is not a multiple of 3 bytes, one or two = signs pad the end so the length is a multiple of 4.
How to Base64 Encode and Decode With This Tool
Step 1: Choose Encode or Decode
Select Encode to Base64 to base64 encode your text, or Decode from Base64 to turn a Base64 string back into text. The labels change to match.

Step 2: Paste Your Input
Type or paste into the box and the result appears as you type. For a base64 decode, spaces and line breaks are ignored, and both the standard and URL safe alphabets are accepted, with or without padding.

Step 3: Set the Encoding Options
Tick URL safe for links, file names and tokens, remove padding if the receiving system does not expect it, and wrap at 76 characters for email (MIME). Leave all three unticked for standard Base64.

Step 4: Copy the Output
Press Copy output, or Use output as input to run a base64 decode on the result and check the round trip. The stats show characters, UTF-8 bytes and lines, and the message box tells you if the input is invalid or decodes to binary data rather than text.

How Does Base64 Turn Text Into Characters?
Base64 turns text into characters by reading the bytes as one long string of bits and cutting it into 6 bit pieces. The classic example in the Wikipedia article on Base64 is the word "Man": its bytes 77, 97 and 110 become the 6 bit values 19, 22, 5 and 46, and those map to the letters T, W, F and u. The table shows how padding appears when the input does not divide neatly into groups of three bytes.
| Input | UTF-8 bytes | Base64 | Note |
|---|---|---|---|
| A | 1 | QQ== | Two = signs: 1 byte left over |
| AB | 2 | QUI= | One = sign: 2 bytes left over |
| Man | 3 | TWFu | Exact group, no padding |
| Hello | 5 | SGVsbG8= | 5 bytes become 8 characters |
| £5 | 3 | wqM1 | The £ sign uses 2 bytes in UTF-8 |
| Bytes 251 and 255 | 2 | +/8= (URL safe: -_8=) | Where the two alphabets differ |
Worked example: Sam is testing an API that uses HTTP Basic authentication with a test account "sam" and the password "Tea4Two!". The header needs "sam:Tea4Two!" in Base64: 12 bytes become 16 characters, c2FtOlRlYTRUd28h, sent as "Authorization: Basic c2FtOlRlYTRUd28h". Pasting that string into decode mode shows the password again instantly, which is why Basic authentication must only run over HTTPS.
Is Base64 Encryption?
No, Base64 is not encryption, because there is no key and anyone can run a base64 decode in a second. It only changes how data is written, not who can read it. To check that data has not changed, a hash from the SHA-256 hash generator works better because it cannot be reversed, and to keep data secret you need real encryption with a key.
Why Is Base64 Output About 33% Bigger?
Base64 output is about 33% bigger because every 3 bytes of input become 4 characters, a ratio of 4 to 3. A 300 KB image becomes about 400 KB of text, and MIME line breaks add roughly 3% more. That is why large images are usually better served as normal files than embedded in a page.
Small icons and fonts are the exception, where saving a request can be worth the extra bytes after you base64 encode them. To embed an image, the image to Base64 converter reads the file locally and builds a ready data URI, while this base64 converter is best for text, tokens, JSON snippets and configuration values.
Key Base64 Encoding Terms Explained
These terms explain the standards and building blocks behind every base64 encode and decode result produced by the tool on this page.
- RFC 4648
- The internet standard that defines Base64 and its URL safe variant. It sets the 64 character alphabet of A to Z, a to z, 0 to 9, + and /, plus the = sign for padding.
- UTF-8
- The text encoding that turns characters into bytes before Base64 runs. Plain letters use 1 byte, while the £ sign uses 2, which is why £5 is 3 bytes and encodes to wqM1.
- Padding
- One or two = signs added to the end of Base64 output so its length is a multiple of 4. One byte left over gives two = signs and two bytes give one, as in QQ== and QUI=.
- URL safe alphabet
- A Base64 alphabet that replaces the plus sign with a hyphen and the slash with an underscore, so the output can sit in links, file names and tokens without escaping. JSON Web Tokens use it, usually without padding.
- Data URI
- A way to embed a file directly in HTML or CSS as text, beginning with data: and the file type, followed by Base64. It suits small icons, because Base64 makes data about 33% bigger.
</>Embed this calculator on your website
Add the free Base64 Encode and Decode to your own site or blog. Copy the code below and paste it into an HTML block. It resizes itself and works on phones.
How we checked this tool: Zahid Awais built this tool, checked it against the official rules or published standards where they apply, and tested it against worked examples. Results are estimates for planning, not personal financial or tax advice. Read our editorial policy and disclaimer, or report an error.
Related Tools and Guides
Frequently Asked Questions
How do I decode a Base64 string?
Choose Decode from Base64, paste the string and the text appears instantly. The tool accepts standard and URL safe Base64, with or without = padding, and ignores spaces and line breaks copied from emails or logs.
Why does my decoded text show strange characters?
The data was probably not UTF-8 text. It may be an image, a compressed file or text in an older encoding. The tool detects this and shows the first bytes as hex instead of garbled letters.
What does the = sign mean at the end of Base64?
It is padding. One = means the last group held 2 bytes and two = signs mean it held 1 byte. Padding keeps the length a multiple of 4, and many decoders, including this one, work without it.
What is URL safe Base64?
It is the RFC 4648 variant that uses - and _ instead of + and /, because + and / have special meanings in URLs and file paths. JSON Web Tokens use it, usually with the padding removed.
Can Base64 encode emoji and accented letters?
Yes, when the text is converted to UTF-8 bytes first, as this tool does. The browser's basic btoa function fails on characters outside Latin 1, which is a common bug in scripts that skip the UTF-8 step.
Is it safe to paste private data into this tool?
The encoding runs entirely in your browser and nothing is sent to a server. Even so, remember that Base64 hides nothing, so treat encoded passwords, keys and tokens as if they were plain text.