How Base64 works
Base64 writes any data using 64 safe characters: A to Z, a to z, 0 to 9, plus and slash. RFC 4648, the IETF standard, takes the input three bytes at a time (24 bits) and writes them as four characters of six bits each. When the input does not divide by three, one or two equals signs pad the end. That is why Base64 is about a third larger than the original: a 30 KB image becomes about 40 KB of text. It is an encoding for carrying data through systems built for text, such as e-mail, JSON and HTML, not a way to hide it.
Arabic and other scripts in Base64
Base64 works on bytes, not letters, so text must first be turned into bytes. This tool always uses UTF-8, the encoding the web and JSON use, which is why "مرحبا" becomes 2YXYsdit2KjYpw== and decodes back to the same word. Many quick converters use the browser's btoa function directly, which fails or garbles anything outside Latin-1; here Arabic, Persian, Urdu, Hindi and emoji are handled the same as English. If decoding gives bytes that are not valid UTF-8 text, the tool treats them as a file instead of showing broken characters.
Image to Base64 and Base64 to image
Choose File to Base64 and pick a PNG, JPG, WebP, SVG or GIF to get a data URL such as data:image/png;base64,iVBOR…, which you can paste into an HTML img tag, a CSS background or a JSON field. The same output menu gives plain Base64, a full img tag or a CSS line. To go the other way, paste a data URL or bare Base64 into Decode: the tool reads the first bytes of the result to recognise PNG, JPEG, GIF, WebP, BMP, ICO, AVIF, SVG and PDF files, shows images as a preview and saves the file with the matching extension. Small icons and logos suit data URLs; for large photos a normal image file loads faster, because the encoded text is larger and cannot be cached on its own.
URL-safe Base64, padding and line breaks
RFC 4648 also defines base64url, which uses minus and underscore instead of plus and slash so the result is safe in web addresses and file names; it is used in JSON Web Tokens. Tick URL-safe to produce it, and No padding to drop the equals signs as JWTs do. Older e-mail (MIME) wraps Base64 at 76 characters per line; tick the 76-character option to match. When decoding, the tool accepts all of these forms, ignores spaces and line breaks, and adds missing padding itself.
Base64 is not encryption
Anyone can decode Base64 in a second, so never use it to protect passwords or personal data. A password stored as Base64 is as good as plain text. To protect a file use real encryption, such as a password-protected PDF, and to make a strong password use a generator.