Base64 Encoder & Decoder
Encode text or the original bytes of a local file, and decode Base64 into UTF-8 text or a downloadable file. Choose Encode, Decode or Auto; Auto guesses from the decoded text and can be overridden. Both standard and URL-safe input work, with or without padding. Images and other files can be copied as Base64 or as a standard data URI for HTML and CSS. Processing happens in this browser; pasted text is kept as a local draft.
Converted output appears here.
·
- Direction
- Alphabet
- Encoding options
Auto is a guess based on decoded UTF-8 text. Select Encode to treat a Base64-looking string as literal text, or Decode for binary files. Both alphabets and omitted padding are accepted when decoding. Dropping a file encodes its original bytes.
Common questions
- How do I encode or decode a string without guessing the direction?
- Choose Encode to treat the input as literal UTF-8 text, or Decode to treat it as Base64. QUJD illustrates the difference: Decode produces ABC, while Encode produces UVVKRA==. Auto tries to identify readable decoded text, so it can misinterpret a string that happens to be valid Base64. The separate encoder and decoder pages open the corresponding direction. JSON, XML and HTML source can be encoded or decoded as text; the output is not parsed, validated or executed.
- How do I convert an image or file to Base64?
- Select Encode a file or drop a file on the tool. PNG, JPG, SVG, GIF, PDF, ZIP, audio and other files are encoded from their original bytes; they are not resized, recompressed or transcoded. Copy file Base64 uses your selected alphabet, padding and wrapping. Copy data URI always uses the standard alphabet and padding, so it can be placed in an HTML image source or a CSS background. Download file Base64 saves the encoded payload as a local text file.
- How do I decode Base64 to an image, PDF, ZIP or Excel file?
- Choose Decode and paste the encoded payload or its ;base64 data URI, then download the decoded file. Open Base64 text file reads an encoded value from a local text file. PNG, JPG, GIF and WebP header bytes enable a raster preview; SVG is offered as a download. The original bytes must already represent the desired file: a Base64 PNG does not become a JPG, a picture does not become a PDF, and arbitrary text does not become an Excel workbook. A few header bytes or a data URI label suggest a filename extension; you can supply the correct filename yourself.
- Why do accents or emoji fail in tools that call btoa directly?
- btoa treats characters as Latin-1 byte values rather than UTF-8. For café it encodes the single-byte é instead of UTF-8; characters such as Japanese text or emoji are outside its range and throw. This tool encodes valid text to UTF-8 first. Decoding requires valid UTF-8 to display text, while any binary result can still be downloaded without replacing bytes. UTF-16 and other legacy text character sets are not interpreted here.
- What is Base64URL, and can I omit padding or line breaks?
- Base64URL replaces + and / with - and _. The Base64URL page opens URL-safe output with omitted = padding and no wrapping. The decoder accepts either alphabet and optional padding. Omit = padding and Wrap at 76 (MIME) are independent controls; turn wrapping off for one continuous line. File payload output updates when these controls change. A Base64 data URI still uses standard characters and padding. The URL-safe alphabet still contains - and _, so it is not alphanumeric-only. Base64URL is different from percent-encoding a URL or form value.
- Can I convert between standard Base64 and Base64URL?
- For text, decode the source, copy the resulting text back into the input, choose Encode and select the target alphabet. For binary data, download the decoded file, select Encode a file and choose the target alphabet. This is a manual decode/re-encode workflow that preserves bytes. Merely pressing Encode on an already encoded string encodes the literal string again.
- Why does Base64 add about one third to the file size?
- Three bytes become four characters, plus any final padding, so large payloads grow by about one third. The displayed overhead compares the original bytes with the encoded payload and excludes a data URI prefix and wrapping. Binary download restores the original bytes and size. No cutoff is imposed by the tool, but browser memory, string size and local-storage quotas remain practical limits.
- Can I use this for a Basic authorization header?
- Enter the literal username:password string, choose Encode and use the standard alphabet with padding and no wrapping. Copy the output and prepend Basic followed by a space in the application that needs the header. Client-id/secret pairs can be encoded the same way when the consuming protocol specifies that construction. This tool does not authenticate a request, sign a JWT, derive keys, encrypt data or reverse a password hash. Base64 is readable encoding.
- Does it fetch image URLs, decompress data or process every line separately?
- No. Select a local file or paste the encoded value. Remote URL fetching, clipboard-image input, MIME-message parsing, gzip/zlib decompression, ZIP extraction, SAML/protobuf parsing, QR reading and image-format conversion are separate jobs. Whitespace in Base64 is ignored, so wrapped lines form one value; they are not decoded as independent records. The output remains inert text or a local download.
- Is my input uploaded or saved?
- Input text and file bytes are processed locally and are not uploaded by this tool. The text draft and selected options are remembered in this browser; local file bytes are not persisted. Clear text removes the draft and Clear the file removes the selected file. A preset can choose initial options without overwriting remembered values; selecting the corresponding control saves that choice. Conversion can continue without a connection after the page has loaded.
Encoding preserves valid UTF-8 text or the original file bytes. Decoding restores those bytes; invalid UTF-8 is kept as binary data for download. Auto direction and inferred file types are best-effort guesses, and no file-format conversion or validation is performed.