Runs in your browser. Your files and text never leave your device - nothing is uploaded.
Encode Text to Base64 Online
The Tools Kit’s free Base64 Encoder converts any text into a Base64 string the moment you type it. Base64 represents data using only 64 printable ASCII characters, which lets it pass safely through JSON fields, HTTP headers, email bodies, environment variables and data URIs that might otherwise mangle special characters.
The encoder is UTF-8 safe: your text is turned into UTF-8 bytes first, so accented letters, non-Latin scripts and emoji all encode correctly as UTF-8. Everything runs in your browser, and nothing you type is uploaded. To reverse the process, paste the result into the Base64 decoder.
How to Use the Base64 Encoder
- 1
Enter your text
Type or paste the text you want to encode into the Plain Text Input box. Spaces and line breaks count as part of the input.
- 2
Read the Base64 output
The Base64 string appears in the Base64 Output panel as you type. There is no Encode button to press and no settings to choose.
- 3
Copy the result
Click Copy Base64 to put the encoded string on your clipboard, ready to paste into code, a config file or a header.
- 4
Clear and start again
Click Clear to empty the input box and encode something new.
The output is standard Base64 on a single line, with no line wrapping, so it can be pasted straight into code or a config file.
How Base64 Encoding Works
Base64 reads the input three bytes (24 bits) at a time and splits those bits into four groups of six. Each 6-bit value, from 0 to 63, is mapped to one character of the alphabet: A-Z for 0 to 25, a-z for 26 to 51, 0-9 for 52 to 61, then + and /. Take the word Man: its bytes are 77, 97 and 110, which regroup into the 6-bit values 19, 22, 5 and 46, giving TWFu.
When the input does not divide evenly into three bytes, the last group is padded with =. That is why the output length is always 4 × ceil(bytes ÷ 3) and the result is roughly a third larger than the original. If you want to see the raw bits behind each character, the binary converter shows the UTF-8 bytes of any text in binary.
| Input text | UTF-8 bytes | Base64 output |
|---|---|---|
| Man | 3 | TWFu |
| Ma | 2 | TWE= |
| M | 1 | TQ== |
| Hello, World! | 13 | SGVsbG8sIFdvcmxkIQ== |
| café | 5 | Y2Fmw6k= |
| user:pass | 9 | dXNlcjpwYXNz |
UTF-8, Emoji and the btoa Problem
The browser’s built-in btoa() function only accepts characters in the Latin-1 range, so calling it directly on text like 日本 or an emoji throws an error, and accented letters such as é are encoded as single Latin-1 bytes rather than UTF-8. This tool works around both problems by first converting the text to UTF-8 bytes and only then applying Base64. The letter é becomes two bytes, which is why café is four characters but five bytes, and an emoji usually takes four bytes.
If a paste cut an emoji in half, the leftover fragment cannot be converted to UTF-8, and the tool shows a short message asking you to retype the character rather than producing broken output. For text that needs a different kind of escaping, the HTML entity encoder turns characters like < and & into entities that are safe inside HTML markup.
Base64 vs URL-Safe Base64 and Other Encodings
This encoder outputs standard Base64, which uses + and /. Those two characters have special meanings in URLs, so the URL-safe variant, Base64url, replaces them with - and _ and usually drops the padding. JSON Web Tokens use Base64url for their header and payload, which you can inspect with the JWT decoder. If you need to put a standard Base64 string in a query parameter, run it through the URL encoder so the +, / and = characters are percent-encoded.
Base64 is also not the only text-safe encoding. Base32 uses a smaller, case-insensitive alphabet that suits one-time password secrets and file names, at the cost of longer output; you can try it with the Base32 encoder. And because Base64 hides nothing, data that must be verified rather than merely transported should be signed, for example with the HMAC generator, which produces a hex signature from a message and a secret key.
Common uses
- Building an HTTP Basic Authorization header from a username:password pair
- Embedding a value with quotes, line breaks or special characters in JSON, YAML or an environment variable
- Creating a text data URI, such as data:text/plain;base64,... or an inline SVG
- Preparing test fixtures and payloads for APIs that expect Base64 fields
- Encoding a Kubernetes Secret value or similar config entry that must be stored as Base64
To encode a photo or other image rather than text, use the image to Base64 converter, which produces a complete data URI. For more formatters, encoders and converters, browse all developer tools.
Base64 terms explained
| Term | What it means here |
|---|---|
| Base64 | An encoding that represents any bytes using 64 printable ASCII characters, so binary or non-ASCII data can travel through text-only channels |
| Alphabet | The 64 characters used: A-Z, a-z, 0-9, plus (+) and slash (/), as defined in RFC 4648 |
| Padding (=) | One or two equals signs added at the end when the input length is not a multiple of 3 bytes, so the output is always a multiple of 4 characters |
| UTF-8 | The character encoding this tool applies to your text before Base64, so accented letters and emoji become well-defined bytes |
| Base64url | A URL-safe variant that swaps + and / for - and _ and often drops padding; this tool outputs standard Base64, not Base64url |
| Data URI | A URL such as data:text/plain;base64,... that embeds content directly inside HTML, CSS or JSON |
Frequently Asked Questions
Type or paste your text into the input box and the Base64 version appears instantly in the output panel. Click Copy Base64 to copy it. There is nothing to install and no account to create.
No. Base64 is a reversible encoding with no key, so anyone can decode it in seconds. It changes how data is represented, not who can read it. Never use it to hide passwords, API keys or personal data.
Yes. The text is converted to UTF-8 bytes before encoding, so accented letters, non-Latin scripts and emoji are encoded correctly. For example, café is 5 UTF-8 bytes and encodes to Y2Fmw6k=.
Base64 turns every 3 bytes into 4 characters, so the output is about 33% larger than the input. The exact length is 4 × ceil(bytes ÷ 3): Hello, World! is 13 bytes and becomes 20 characters, SGVsbG8sIFdvcmxkIQ==.
They are padding. When the input is not a multiple of 3 bytes, one or two equals signs fill out the last 4-character group. Man encodes to TWFu with no padding, Ma to TWE= and M to TQ==.
No. It outputs standard Base64 using + and / with = padding. For Base64url, replace + with -, / with _ and usually strip the trailing = signs, or percent-encode the standard string before putting it in a URL.
No. Encoding runs entirely in your browser with built-in JavaScript functions. Your text is not sent, stored or logged, which makes the tool safe to use with configuration values and test data.
No. This encoder accepts typed or pasted text only and has no file upload. To turn a JPG, PNG, GIF, SVG or WebP into a Base64 data URI, use the Image to Base64 tool on The Tools Kit instead.
Paste the Base64 string into the Base64 Decoder on this site and the original UTF-8 text is returned. Because Base64 is lossless, decoding gives back exactly what you encoded, including spaces and line breaks.
That happens when the text includes half of an emoji or another character stored as a surrogate pair, usually left behind by a truncated copy. That half cannot be turned into valid UTF-8, so the tool shows a message instead of output. Retype or re-copy the character to fix it.
Enter the username and password joined by a colon, such as user:pass, and copy the result, dXNlcjpwYXNz. The header is then Authorization: Basic dXNlcjpwYXNz. Remember this is encoding, not protection, so only send it over HTTPS.
Reviewed by Raja Jahangir · Last reviewed: October 7, 2026
What is Base64 encoding?
Base64 encoding converts binary data into 64 printable ASCII characters so it can travel safely through systems that expect text, such as email bodies, JSON fields, and data URLs. Base64 is an encoding, not encryption - anyone can decode it, so it protects nothing.
