Base64 Encode / Decode
Base64 Encoder & Decoder
Encode text or files, decode Base64, and convert Base64URL instantly.
What is Base64?
Base64 represents binary data as printable characters. It is useful for data transfer, APIs and embedding small assets, but it is not encryption.
Base64URL replaces + and / with - and _. The decoder accepts both alphabets, with or without padding. Text is interpreted as UTF-8. For non-text data, select File and then Decode to download the original bytes.
Choose your conversion mode, enter your content, and receive the result automatically. The tool also supports URL-safe Base64, optional padding removal, downloadable results, and Base64 data URIs. Its conversion logic runs locally in your browser rather than submitting your input to a separate conversion server.
What Is Base64 Encoding and Decoding?
Base64 is a binary-to-text encoding scheme that represents raw bytes using a restricted set of printable characters. Developers use it when a system needs to carry binary information through a text-oriented format, such as a JSON payload, an email message, or a structured data field.
Standard Base64 uses 64 symbols: uppercase letters A–Z, lowercase letters a–z, digits 0–9, and the characters + and /. The equals sign (=) may appear at the end as padding, but it is not one of the 64 data symbols.
Encoding transforms bytes into a Base64 string. Decoding reverses that transformation to recover the original bytes. When those bytes represent text, you must interpret them using the correct character encoding, typically UTF-8.
The underlying behavior is standardized in RFC 4648: The Base16, Base32, and Base64 Data Encodings, which defines the alphabets, padding conventions, and interoperability requirements.
How to Use the Base64 Encoder and Decoder
You do not need technical experience to perform a basic conversion. The interface separates the input and output areas, updates results as you type, and provides controls for copying, downloading, clearing, and reversing conversions.
1. How to Encode Text to Base64
Select Encode under Action, then choose Text as the input type. Type or paste your message into the INPUT area. The encoded value appears automatically in the OUTPUT area.
For example, enter Hello World. The resulting Base64 string is:
Click Copy to put the result on your clipboard, or Download to save it as a text file. Use Swap to move the output back into the input field and reverse the conversion direction.
2. How to Decode Base64 to Readable Text
Select Decode and keep the input type set to Text. Paste a Base64 string into the input editor, and the tool attempts to reconstruct the original UTF-8 text.
Try entering SGVsbG8gV29ybGQ=. You should receive Hello World. If the decoded bytes are not valid UTF-8, the tool displays an error instead of silently replacing invalid characters.
💡 Useful distinction: A valid Base64 string does not necessarily contain readable text. It may represent an image, a PDF, compressed data, or another binary format. If text decoding fails, switch to File → Decode to recover the underlying bytes.
3. How to Encode a File to Base64
To encode a local file, choose Encode → File. Click Choose a file or drag and drop a supported file into the upload area. You can select an image, PDF, text document, or another binary file, provided it falls within the tool’s size limit.
Once the browser reads the file, the Base64 representation appears in the output panel. You may copy it or download it as a text file. If you need a data URI for a small asset, enable Include data URI before copying the output.
The tool supports files up to 8 MiB (8,388,608 bytes). Although the interface describes this as 8 MB, the implemented threshold is based on binary mebibytes. Larger files are rejected.
4. How to Decode Base64 Back Into a File
Choose Decode → File and paste your Base64 string into the input field. The tool decodes it into binary bytes and enables the download option.
If the content is valid UTF-8 and sufficiently small, you may also see a text preview. For binary content, the interface directs you to download the recovered data instead.
When decoding a Base64 data URI containing a recognized MIME type, the tool can use that information to select a file extension. Otherwise, the downloaded file may use the generic .bin extension. Rename it only after confirming its actual format.
How Base64 Encoding Works Behind the Scenes
The encoding algorithm processes input in groups of three bytes. Each byte contains eight bits, so three bytes provide 24 bits of information. The algorithm divides those 24 bits into four groups of six bits, then maps each group to a character from the 64-symbol alphabet.
Consider the ASCII text Man. Its bytes contain the decimal values 77, 97, and 110. After the bit groups are rearranged and mapped, the resulting Base64 text is TWFu.
Man becomes TWFu. The encoded representation uses four ASCII characters to carry the original three bytes.
✅ Why Does Base64 Increase Data Size?
📊 Base64 is designed for compatibility, not compression. For complete three-byte groups, it produces four encoded characters, an overhead of approximately 33.3% before transport-specific line breaks or other framing.
For padded standard Base64, the exact encoded length in characters is 4 × ceil(input bytes / 3). A three-byte input becomes four characters, six bytes become eight, and nine bytes become twelve.
Short inputs can have a larger percentage overhead because padding completes the final four-character group. For example, a single byte becomes four Base64 characters. UTF-8 text also requires attention to byte length: a visible character such as an emoji can occupy multiple bytes before encoding.
This is why Base64 should not replace file compression or ordinary binary transfer when efficiency matters.
Standard Base64 vs. URL-Safe Base64: What’s the Difference?
Base64URL is a variation designed for contexts where certain characters have special meanings, particularly URLs and filenames. It preserves the underlying data while changing two alphabet symbols.
| Property | Standard Base64 | Base64URL |
|---|---|---|
| Symbol 62 | + |
- |
| Symbol 63 | / |
_ |
| Padding | Normally uses = when needed |
May omit = when permitted |
| Common applications | Email, data URIs, general binary encoding | JWTs, URL parameters, filenames |
| Encryption provided | None | None |
To generate Base64URL in this tool, enable URL-safe Base64. If the receiving system expects unpadded output, also select Omit padding (=). These are separate controls.
The decoder accepts both standard and URL-safe alphabets, including valid unpadded input. It also ignores common ASCII whitespace, making it convenient to decode strings copied from formatted documents or multiline text.
For JSON Web Signatures, the RFC 7515 specification requires Base64URL without trailing padding. Remember that decoding a token’s components does not verify its signature or establish that the token is trustworthy.
What Is a Base64 Data URI?
A data URI allows certain content to be represented directly inside a URL-like string instead of referencing a separate file. A Base64-encoded PNG image, for example, may begin with:
When you select Encode → File, the Include data URI option generates the appropriate prefix using the file’s reported MIME type where available. In this mode, the tool uses standard Base64 with canonical padding rather than URL-safe characters.
Data URIs can be convenient for embedding very small icons, graphics, and other assets. However, large embedded files increase document size and can reduce caching flexibility. An ordinary image file is often a better choice for substantial visual content.
For other image-related tasks, you can explore 🔗 Free Image Tools.
Where Is Base64 Encoding Used?
1. API Requests and JSON Data
APIs frequently exchange information using JSON, which represents strings but does not provide a native binary data type. Base64 can carry binary bytes inside a JSON string when the API explicitly requires this representation. Always follow the receiving API’s schema instead of assuming that every binary field accepts Base64.
2. Email Attachments
Base64 has a long history in email systems. MIME uses content-transfer encodings to represent attachments and other content within email transport formats. MIME also defines line-length requirements that differ from a continuous Base64 string, so a generic encoder’s output may need additional formatting for that environment.
3. JWTs and Web Authentication
JSON Web Tokens commonly contain Base64URL-encoded segments separated by periods. A decoder can help you inspect an individual segment, but a complete JWT is not one Base64 string: its periods are structural separators.
⚠️ Security note: Reading a decoded JWT payload does not prove that the token is valid. Proper authentication requires checking the applicable signature, algorithm, issuer, audience, expiration, and other required claims.
4. Small Embedded Assets and Developer Workflows
Developers sometimes encode small icons, configuration data, or test payloads when working with text-only interfaces. Base64 can simplify those workflows without requiring a separate file-transfer mechanism, but it does not make the embedded content safe to execute or render.
At Noxoric, the tool is designed around practical developer tasks: UTF-8 conversion, recovery of binary files, Base64URL formatting, and direct access to results without an additional conversion-service request. You can find related utilities in 🔗 Free Developer Tools.
Advantages and Disadvantages of Base64 Encoding
The main tradeoff is straightforward: Base64 improves compatibility with text-oriented systems at the expense of additional size and processing. Use it when your application requires that representation, not as an automatic replacement for binary files.
Is This Base64 Encoder and Decoder Private?
The supplied tool implementation performs text and file conversion using browser APIs, including TextEncoder, TextDecoder, and the browser’s Base64 functions. Its conversion code does not send input text or selected files to a dedicated remote conversion endpoint.
That is a meaningful privacy advantage over tools that require server-side processing. Nevertheless, browser-local conversion should not be confused with a guarantee about every script, analytics component, extension, or service operating on the surrounding website or device.
For sensitive production credentials, private keys, or confidential business information, use an appropriately controlled and trusted environment. Never assume that encoding a secret protects it from anyone who obtains the encoded string.
Common Base64 Errors and How to Fix Them
⚠️ Invalid Base64 Characters or Padding
If decoding fails, verify that the input contains a supported Base64 alphabet and valid padding. Standard Base64 uses letters, digits, +, /, and potentially trailing = characters. URL-safe strings substitute - and _.
This decoder automatically handles valid missing padding and ignores common whitespace. It does not repair arbitrary corrupted or truncated data. If your string contains unrelated punctuation or has lost meaningful characters, obtain the original value again.
⚠️ Decoded Content Is Not Readable
If an encoded value contains binary information, decoding it as UTF-8 text may produce an error. Switch the input type to File while keeping the action set to Decode, then download the reconstructed bytes.
If the decoded bytes are valid text in a legacy character encoding other than UTF-8, this tool does not provide a charset selector. A conversion application supporting that original encoding may be necessary.
⚠️ The File Exceeds the Size Limit
The tool limits encoded or decoded binary data to 8 MiB and restricts Base64 input length to help control browser memory usage. For larger files, consider a trusted local utility or development script that supports streaming rather than loading the entire file into memory.
⚠️ The Paste or Copy Button Does Not Work
Clipboard access depends on browser permissions and security requirements. If the Paste button cannot access the clipboard, use Ctrl+V on Windows or Command+V on macOS. If automatic copying fails, select the generated text manually.
Convert Base64 Text and Files With Confidence
Base64 is most useful when you understand the format your destination expects. Choose standard Base64 for ordinary binary-to-text conversion, switch to Base64URL when your protocol requires URL-friendly characters, and preserve the original bytes when decoding files rather than forcing binary content into text.
For day-to-day conversion, the workflow is simple: select Encode or Decode, provide your text or file data, confirm the output format, and copy or download the result. Remember that encoded content remains reversible and should never serve as a substitute for encryption.
🚀 Use the Base64 Encode / Decode tool whenever you need a quick conversion, and explore more practical developer, text, and file utilities at Noxoric.