Base64 Encoder / Decoder
/base64-encoder/
Related tools
Comments
About this tool
Where Base64 encoding is used
Base64 writes arbitrary bytes using only 64 characters: 52 upper and lower case letters, 10 digits, + and /. It is widely used wherever binary data or special characters have to travel through a text-only channel: email attachments, data:image/png;base64 URLs that embed images directly in HTML and CSS, HTTP Basic authentication headers, JWTs and Kubernetes Secret values.
Read moreShow less
During development you often meet an unreadable block of letters in an API response or configuration file. If it ends in = or == and consists only of A to Z, a to z, 0 to 9, + and /, it is very likely Base64. This tool decodes such strings back to text, or encodes text to Base64 to produce a value for a configuration file or request header.
The standard is RFC 4648, published in 2006. The same document defines regular Base64 alongside the base64url variant that is safe for URLs and file names, as well as Base32 and Base16, which is why different languages produce identical results.
How Base64 turns 3 bytes into 4 characters
The idea is straightforward. Take the input bytes three at a time to get 24 bits, split them into four 6-bit pieces, and each piece is a number from 0 to 63 that you look up in the 64-character table. The word Man is three bytes and becomes exactly TWFu, but Ma is two bytes, so the last piece cannot be filled and one = is added, giving TWE=, and a single M becomes TQ== with two. Since 3 bytes become 4 characters, the output is about 33% longer than the input; 300 bytes of text becomes exactly 400 characters.
The browser's built-in btoa function follows an old model in which one character is one byte, so it throws an error on characters above U+00FF, such as Korean. This tool therefore converts the text to UTF-8 bytes with TextEncoder first and then encodes them. A Korean syllable is 3 bytes in UTF-8, so 가 becomes the four characters 6rCA, and '안녕 hello' (Korean for hello, plus the English word) is 12 bytes and becomes the sixteen characters 7JWI64WVIGhlbGxv.
With URL-safe enabled, the output follows the base64url rules of RFC 4648: + becomes -, / becomes _, and trailing = is removed. The Korean name 홍길동 is 7ZmN6ri464+Z in the standard form and 7ZmN6ri464-Z in URL-safe form. Decoding accepts both forms without distinction, ignores spaces and line breaks in the middle, and restores missing = from the length. The decoded bytes are checked as UTF-8 with TextDecoder in strict mode, so you get an error instead of garbled characters.
Choosing standard or URL-safe Base64
Use standard Base64 for email bodies, PEM certificates, data URLs and HTTP header values. For values in query parameters, URL paths, file names or cookies, URL-safe is the right choice, because in the standard form + is read as a space in a query, / is mistaken for a path separator and = for the key-value separator. All three parts of a JWT are base64url too, so pasting the middle part of a token into the decoder shows the payload JSON immediately.
When backend developers prepare values for a Kubernetes Secret or a CI environment variable, it matters that no line break has slipped in. The shell's echo appends a newline, which often changes the last characters of the result; this tool encodes exactly the characters you type, which makes it useful for comparison. Copy copies the whole output.
Base64 is not encryption
The most common misconception is that Base64 hides content. Anyone can reverse it with the same table, without a key or password, so it offers no security at all. The username and password in HTTP Basic authentication and Kubernetes Secrets are merely written in Base64 and are exposed without HTTPS and proper access control. Values that must stay secret need encryption or hashing.
This tool is for text only. Bytes that are not UTF-8 text, such as an image or a zip file, cannot be shown as characters when decoded, so they produce an error, and there is no option to choose a file to encode. Input whose length leaves a remainder of 1 when divided by 4, or that contains characters outside the 64-character table, is also treated as invalid. Conversion happens entirely in this browser and nothing is sent to a server; your input and options are kept in this browser's localStorage for next time, and Reset clears them.
Popular tools
FAQ
Is Base64 encryption?
No. It is a notation anyone can reverse instantly with the same rules. Encoding a password or API key in Base64 does not hide it, so use real encryption when protection is needed.
Why does decoded Base64 show garbled characters?
This usually happens when the original text was in a non-UTF-8 encoding such as EUC-KR, an older Korean encoding, or when the decoding side used the output of atob directly as text. This tool interprets decoded bytes as UTF-8, so UTF-8 text in any language comes out correctly. Bytes that are not UTF-8 produce an error instead of garbled text.
When should I use URL-safe Base64?
Use it for values going into URL query parameters or paths, file names, or JWTs, where + / and = can be read as something else. It uses - instead of + and _ instead of /, and drops the trailing =. Decoding accepts both forms.
What is the = at the end of Base64?
It is padding that fills the remaining space when the input is split into 3-byte groups. Two leftover bytes get one =, and one leftover byte gets two. This tool also decodes input with the = missing by restoring it from the length.
How much longer does Base64 make data?
Every 3 bytes become 4 characters, so about 33% longer. 300 bytes become 400 characters, and since a Korean syllable is 3 bytes in UTF-8, each one turns into about 4 Base64 characters.
Is what I enter saved?
Nothing is sent to a server; encoding and decoding both run in this browser. Your input and options are kept in this browser's localStorage so you can continue later, and Reset clears them.