Base64 Encoder & Decoder Tool

Base64 Tool
EncodeDecode
Response
Valid
No Output Yet

Upload a file or type text to generate Base64.

Answers on RFC 4648 mechanics, URL-safe strings, padding rules, and common decode errors.

Base64 Encoding & Decoding Questions

RFC 4648 defines Base64 as a binary-to-text scheme that groups input data into 24-bit blocks (3 bytes) and splits each block into four 6-bit values. Those values map to 64 printable ASCII characters: A-Z, a-z, 0-9, plus (+), and forward slash (/). Converting raw bytes into plain ASCII prevents text-only channels like JSON or email MIME bodies from corrupting binary content.
No key exists in Base64 because the lookup table is public and reversible by anyone. When decoding a valid Base64 string produces unreadable binary symbols, the data was usually encrypted (for example with AES) or compressed (such as gzip) before being Base64-encoded. Unwrapping the Base64 text gives you the raw ciphertext bytes, which still require the original cipher and key to decrypt.
Four 8-bit ASCII characters are needed to represent every three 8-bit bytes of binary input, since each Base64 digit only carries 6 bits of source data (4 divided by 3 equals 1.333). Older MIME email systems (RFC 2045) also insert CRLF line breaks every 76 characters, nudging total overhead closer to 37%.
Input byte lengths do not always divide evenly by 3. When 2 bytes remain in the final group, the encoder writes 3 characters followed by one equals sign (=); when 1 byte remains, it writes 2 characters followed by two equals signs (==). That trailing marker tells the decoder how many zero-padded bits to drop when restoring the original bytes.
URLs treat plus (+) and forward slash (/) as reserved query and path characters. Section 5 of RFC 4648 solves this with base64url, substituting hyphens (-) for plus signs and underscores (_) for slashes while often dropping trailing = padding. Before pasting a base64url token from a JWT or URL parameter into a standard decoder, replace hyphens (-) with plus signs (+), replace underscores (_) with slashes (/), and pad the string length to a multiple of 4.
Most decoding errors come from leaving a Data URI header (like data:image/png;base64,) attached at the start, pasting URL-safe hyphens (-) and underscores (_) into a standard decoder, or copying percent-escaped characters such as %3D and %2B from a URL. Missing = characters at the end of a truncated string will also fail validation if the character count is not a multiple of 4.
Browser btoa() and atob() functions were designed for single-byte Latin-1 strings, where every character fits inside 0x00 to 0xFF. Multi-byte Unicode characters and emojis exceed one byte per code unit and trigger an InvalidCharacterError unless the text is converted into UTF-8 bytes before encoding, which this Base64 tool handles automatically.
File mode accepts uploads up to 10 MB across PDF, CSV, JSON, plain text (.txt), PNG, JPEG, SVG, and WebP formats. Uploading a file in Encode mode outputs its raw Base64 string, while uploading a .txt file in Decode mode reads the encoded text for conversion.
Toggle the switch to Decode mode, paste your raw Base64 string (without any data:...;base64, prefix) or upload a .txt file, and click Download as Original File in the Response panel. Your browser reconstructs the binary bytes locally as decoded_file, which you can rename with its original extension such as .pdf or .png.
Never. All encoding and decoding runs locally inside your browser using client-side JavaScript and the FileReader API. Pasted text and uploaded files stay on your device and clear from memory as soon as you reset or close the page.
Disclaimer
This Base64 Encoder & Decoder Tool processes text and files locally in your browser. Remember that Base64 is reversible encoding rather than encryption: never rely on it alone to protect passwords or confidential keys in transit.