About this tool
This tool converts plain text into Base64 as you type, with an optional URL-safe output. Developers use it to embed text in data URLs, JSON, HTTP headers, and email. Base64 is an encoding that represents binary data with 64 printable ASCII characters, turning every 3 bytes into 4 characters. It makes data safe to transport as text, but it does not hide or protect it.
How it works
Type or paste text into the input box, or use the buttons to paste from the clipboard, upload a text file or insert sample text. The Base64 result appears immediately, with character and byte counts and the size ratio between output and input. The byte count is the UTF-8 size of your text, which is what Base64 actually encodes.
Turn on URL-safe output if the result will go into a URL, a file name or a token, since the standard plus and slash characters can break those. Copy the result or download it as a .txt file when you are done. Keep in mind that anyone can reverse Base64, so it is a transport format for text rather than a way to hide it.
Example
The text Hello? is 6 bytes and encodes to SGVsbG8/ in standard Base64. With URL-safe output turned on, the slash is replaced and the result becomes SGVsbG8_. Non-ASCII text is converted to UTF-8 first: the word café is 5 bytes in UTF-8 because é takes two bytes, so it encodes to 8 Base64 characters.
A longer phrase shows the padding rule. Hello, world! is 13 bytes, which is four full 3-byte groups plus one leftover byte. The result, SGVsbG8sIHdvcmxkIQ==, is 20 characters long and ends with two equals signs because the final group held only one byte.
Assumptions and limits
Input is treated as text and encoded as UTF-8; the uploaded file is read as text, so binary files such as images are not encoded byte for byte. URL-safe mode uses the base64url alphabet and removes trailing padding. Encoding runs in your browser, and links never carry your input text.
Frequently asked questions
Is Base64 encryption?
No. Base64 is a reversible encoding with no key, so anyone can decode it. Use real encryption to protect sensitive data.
Why is Base64 output larger than the input?
Base64 turns every 3 bytes into 4 characters, so the output is about 33% larger than the input, plus up to two padding characters at the end. Short inputs show a larger ratio because padding has more weight: 13 bytes become 20 characters. If size matters, compress the data first or send it as binary where the protocol allows it.
What is URL-safe Base64?
URL-safe Base64, or base64url, replaces the plus sign with a hyphen and the slash with an underscore, because those characters have special meanings in URLs and file paths. Padding is often omitted. JSON Web Tokens use this variant.
How does Base64 handle emoji and non-English text?
Base64 encodes bytes, not characters, so text must first be converted to bytes. This tool uses UTF-8, the standard web encoding, where letters outside ASCII take 2 to 4 bytes each. The euro sign € takes 3 bytes, and the emoji 👍 takes 4 bytes and encodes to 8J+RjQ==.
Can I convert an image or other binary file to Base64 here?
No. Uploaded files are read as text, so images, PDFs and archives would not be encoded byte for byte and the output would be wrong. This encoder is meant for text such as JSON snippets, credentials for a Basic auth header or short messages. For binary files, use a tool or command that reads the raw bytes, such as base64 on the command line.
Link with your values
Add these parameters to this page’s address to open it with the values filled in, for example to share a calculation or to link to it from an AI assistant. The result is calculated in the browser: the page HTML shows an example for the default values, and the tool sets the data-url-params attribute once the link’s values are applied.
| Parameter | Value | If omitted |
|---|---|---|
textInput Text | not accepted in links: enter it on the page | |
url_safeURL-safe output | true or false | default false |
Examples
?url_safe=true
Write decimals with a point. Encode a space as %20, + as %2B, # as %23 and & as %26.
Result elements: [data-result-block="base64-encoded"]