Turn text or a file into Base64, or decode Base64 back to text. Choose the character encoding; UTF-8 is the default. Hex turns Base64 into hexadecimal bytes. Runs in your browser.
Base64 turns any sequence of bytes into letters, digits, plus and slash so it can travel through systems that only accept text: JSON, HTML, email, and environment variables. It is not encryption. Anyone can reverse it. Use it when you need a safe text form of a file, a UTF-8 string, or a small image, not when you need to hide a secret.
This page encodes and decodes in the browser. The character encoding menu decides which bytes the text becomes. UTF-8 is the default, and it is what modern APIs expect for Chinese, emoji and accented letters. Pick GBK, Big5, Shift_JIS or UTF-16 when the other system is older. Hex means the box is already hexadecimal bytes, so you can turn Base64 into hex and back. A file is read as raw bytes and ignores that menu, so a PNG or PDF stays intact. Nothing is uploaded.
+ and /, with = padding. That is the form used by MIME and most programming libraries.- and _ and drops padding, which is what JWT segments and many query strings use.img or CSS url(). For a real image, encode the file, not the filename.Every three bytes become four characters. If the input length is not a multiple of three, the output is padded with = so the length is a multiple of four. URL-safe mode removes that padding; the decoder puts it back.
A data URI such as data:text/plain;base64,aGVsbG8= is accepted on decode: the header is stripped and only the payload is decoded. Whitespace inside the payload is ignored, which is why an email body with 76-character lines still decodes.
The character encoding changes the bytes before Base64 is applied. The two characters 中文 are six bytes in UTF-8 and four bytes in GBK, so the Base64 strings differ. If another tool disagrees, match its encoding, or switch this page to Hex and compare the bytes. Related tools: string to bytes and URL encode.
user:password.The bytes are not text in the encoding you picked. Try GBK or UTF-16 if the source is an older Chinese or Windows system, or switch to Hex to see the bytes. A decoded image or compressed file will not be readable in the text box. A file is encoded as raw bytes and does not use the character encoding menu.
Yes. Decode accepts both alphabets. You do not have to switch the alphabet dropdown for decoding.
Libraries disagree. This decoder accepts missing padding. When you encode for a strict parser, leave URL-safe off so the = characters stay.
No. Base64 is a reversible text encoding. Do not put passwords or private keys here and assume they are hidden.