Base64 is an encoding scheme that represents binary data or text using only 64 ASCII characters (A-Z, a-z, 0-9, +, /). It breaks every 3 bytes (24 bits) into four 6-bit groups and maps each to a character, which is why encoded data grows by roughly 33%. It is mainly used when you need to carry binary data through a channel that only safely transmits text — an email body, JSON, a URL, or an HTTP header. This tool encodes text to Base64, decodes a Base64 string back to the original text, and converts files like images into data URLs.
When your text mixes in multibyte characters such as Korean or emoji, calling the browser's built-in btoa/atob directly throws an error or mangles the characters because they fall outside the Latin-1 range. This tool first converts the text to UTF-8 bytes with TextEncoder before encoding, and reverses it with TextDecoder on the way back, so characters from any language are restored exactly.
Every conversion runs only in your browser, so your input is never sent anywhere. When you turn a file into a data URL, FileReader reads it locally too, making it safe to work with unreleased images or internal assets.
How to Use
- 1
Enter text
Paste the plain text you want to encode, or the Base64 string you want to decode, into the input box.
- 2
Pick a direction
The 'Encode' button turns text into Base64; the 'Decode' button turns Base64 back into the original text.
- 3
Check and copy the result
The result appears in a monospace font, and the copy button puts it on your clipboard.
- 4
Convert a file (optional)
Use the file picker at the bottom to convert an image or other file into a data URL (e.g. data:image/png;base64,...).
When It's Useful
Embed a small icon in CSS
Turn a logo or icon image into a data URL and drop it straight into your CSS or HTML to render it instantly with no extra HTTP request.
Build a Basic auth header
Encode a 'username:password' string to use as the value of an Authorization: Basic header, or decode a header you received to inspect it.
Recover garbled encoded data
Decode a Base64 string left in a log or response so a human can read what it actually contains.
Generate a data URI for testing
When you need a dummy image during frontend work, convert a file to a data URL and paste it right into your code.
Tips
- A Basic auth header is built by Base64-encoding a 'username:password' string.
- A data URL is handy for embedding small icons directly in CSS or HTML, but since encoding grows the size by about 33%, it is a poor fit for large images.
- If decoding fails, check whether the string contains spaces, line breaks, or URL-safe variant characters (-, _).
- Base64 is encoding, not encryption. Anyone can decode it, so it is not suitable for hiding a password.
- The trailing = signs are padding that rounds the length up to a multiple of four. If padding is cut off, decoding can fail.
- A data URL prefix like 'data:image/png;base64,' is just a header indicating the format; the pure Base64 data starts after the comma.
FAQ
Do Korean characters break?
No. The text is converted to UTF-8 bytes with TextEncoder before encoding, so Korean, emoji, and special characters are all restored exactly.
Are files uploaded to a server?
No. Files are read only by the browser's FileReader and converted to a data URL; nothing is sent anywhere.
Is Base64 secure encryption?
No. Base64 is reversible encoding, not encryption. Anyone can recover the original, so do not use it for security purposes.
Does it support URL-safe Base64?
The default conversion uses standard Base64 (+, /). To handle the URL-safe variant (-, _) used in things like JWTs, replace - with + and _ with / before decoding.
Is there a length limit on what I can convert?
There is no limit for practical text lengths. Very large files may vary in speed depending on your browser's memory.
Why does Base64 encoding increase the size?
It represents 3 bytes with 4 characters, so the output is about 33% larger than the original. Formats that insert line breaks grow slightly more.
Why not just use btoa?
btoa throws an error on characters with a code point above 255 (Korean, emoji, and so on). This tool converts to UTF-8 bytes first, avoiding that problem.
What are the = signs at the end?
They are padding characters that round the output length up to a multiple of four. Zero to two are added depending on the byte count, and they are handled automatically when decoding.