Base64 to File Guide: Decode Bytes and Save the Right Download
Admin ·
Base64 to File recovers the bytes represented by a Base64 string and prepares them for download. Paste the encoded value, choose a filename, press Decode file, check the displayed size and then download. The result can be a picture, document, archive or other binary content, provided those were the bytes originally encoded.
A successful decode answers one question: can this input represent bytes under the tool’s rules? It does not identify the original format, repair missing content or prove that a file is safe. This guide explains the accepted forms and gives practical checks for choosing the right name and recognizing incomplete input.
Recover one file from its encoded value
Paste the complete value into Base64 input and enter a proposed File name. Select Decode file. When validation succeeds, Decoded size shows the number of bytes and the cleaned filename, and Download file becomes available. Downloading is a separate action; merely decoding does not save a file to your device.
For a small check, paste SGVsbG8= and use hello.txt. Decoding produces five bytes spelling Hello, with no added newline. A real file should come from a source that can tell you its expected type and size. This workspace accepts pasted text, not a file upload, a remote link or a batch of encoded files.
- Copy the complete encoded value, without JSON quotes or surrounding log labels.
- Choose an extension that matches the original content.
- Compare the decoded byte count with the sender’s expected size before saving.
RFC 4648: Base16, Base32 and Base64 data encodingsMDN: HTMLAnchorElement.download
Base64 represents bytes; it does not choose their meaning
Three input bytes are normally represented by four Base64 symbols. For a nonempty file of n bytes, the padded representation has 4 × ceil(n / 3) symbols, excluding a data-URL header and added whitespace. A one-byte file uses four padded symbols, so the overhead is not exactly one third for every size. Base64 encoding is a representation change, not compression.
The decoder preserves bytes, including zero bytes and values that are not readable text. It does not reinterpret a PDF or image as Unicode text. If the original bytes contain UTF-8 text, a suitable text editor can display them; a different original character encoding may need a different editor setting. For simply encoding or decoding a text passage, the separate Base64 encoder and decoder may fit the task better.
| Base64 | Recovered content | Byte count |
|---|---|---|
| Zg== | The letter f | 1 |
| Zm8= | The letters fo | 2 |
| Zm9v | The letters foo | 3 |
| AP8= | Binary bytes 00 FF in hexadecimal | 2 |
RFC 4648: Base16, Base32 and Base64 data encodingsMDN: Window.atob()MDN: Blob constructor
Use one supported alphabet at a time
Standard Base64 uses letters, digits, plus and slash. URL-safe Base64 substitutes hyphen and underscore for those last two symbols. ToolMellow accepts either alphabet and normalizes the URL-safe form before decoding. Correct final padding is accepted, and padding may also be omitted when the remaining symbols form a valid final group.
Do not mix alphabet-specific symbols in a single value. For example, //8= and __8= both recover two bytes of value 255, while _/8= is rejected. URL-safe does not mean that you can paste a full web address: the tool does not fetch links, extract a query parameter or split a JSON Web Token. Obtain the actual encoded field first.
A data URL wraps the payload but does not convert it
The supported wrapper has the form data:...;base64,payload, with a header that contains no spaces or commas before the separating comma. The data prefix and base64 marker are matched without regard to letter case. For example, data:text/plain;base64,SGVsbG8= produces the same five bytes as the bare value. The declared media type is discarded; it does not determine the download name or output content type.
Not every data URL uses Base64. data:text/plain,Hello is outside this tool’s accepted form. The tool also does not percent-decode the payload: %3D remains invalid here instead of becoming an equals sign. A JSON string, escaped slash sequence or percent-encoded URL may need to be extracted or decoded at its own representation layer before you have the intended Base64 value. Do that only when the source format calls for it.
| Input form | What the tool does | What to check |
|---|---|---|
| SGVsbG8= | Decodes the bare payload | Use the complete encoded value. |
| data:text/plain;base64,SGVsbG8= | Removes the supported header and decodes | The header does not select a filename or convert bytes. |
| data:text/plain,Hello | Rejects the non-Base64 form | Find the appropriate decoder for that data URL. |
| data:text/plain;base64,SGVsbG8%3D | Rejects the percent escape in the payload | Check whether an outer URL-encoding layer needs removal. |
Valid padding is more than an equals sign at the end
Padding completes the last group when the original byte count is not divisible by three. Zg== and unpadded Zg both represent one byte; Zm8= and Zm8 represent two. A one-symbol final group cannot represent a complete byte. Equals signs in the middle, excessive padding or padding inconsistent with the final group are rejected.
The unused bits in the final symbol must also be zero. Some permissive decoders can obtain a byte from Zh==, but this tool rejects it; the canonical encoding of the letter f is Zg==. Likewise, Zm9= is rejected while Zm8= is accepted. After decoding, the tool re-encodes the bytes and compares them with the normalized unpadded input. This checks canonical representation, not the correctness of the original file.
RFC 4648: Base16, Base32 and Base64 data encodingsMDN: Window.atob()
Count the raw input before removing wrappers or spaces
The input may contain at most 16777216 UTF-16 code units, counted before surrounding whitespace, a data-URL header or supported internal whitespace is removed. A normal Base64 symbol occupies one such unit. The decoded result must be nonempty and no larger than 12582912 bytes, which equals 12 MiB. These bounds describe accepted input and output; they are not a promise that the tab uses only that much memory.
A bare string of 16777216 valid symbols can represent the full 12 MiB output allowance. Adding a header or line breaks uses some of the same input allowance and can make that otherwise valid payload too long. An oversized edit is rejected in full, leaves the previous input in place, clears its old download and displays an error. The tool does not accept a shortened prefix of that edit. Use the original data source or an appropriate larger-file workflow rather than cutting encoded text to make it fit.
| Limit | Exact allowance | Practical consequence |
|---|---|---|
| Raw input | 16777216 UTF-16 code units | Headers and whitespace count before cleanup. |
| Decoded output | 12582912 bytes, or 12 MiB | The output must also contain at least one byte. |
| Filename field | 120 UTF-16 code units | A long name is bounded separately from file content. |
| Concurrent work | One encoded value in the workspace | There is no batch queue or saved-job history. |
Clean copied text without changing its content
Surrounding whitespace is trimmed. Inside the payload, the decoder removes only ASCII space, tab, line feed, carriage return and form feed. This permits ordinary line-wrapped Base64, but an internal vertical tab or nonbreaking space is not ignored. A value copied from a formatted document can therefore fail even when the unexpected character is hard to see.
Get a plain-text copy from the original source when possible. Do not replace every unfamiliar character or remove arbitrary punctuation until the error disappears: a plus sign or slash may be meaningful Base64 data. Similarly, adding equals signs cannot restore missing symbols. The generic error does not identify the exact failing character, so check the wrapper, alphabet, padding and raw length systematically.
Choose a name that describes the recovered bytes
The default name is decoded.bin. The tool replaces selected control characters and path-invalid punctuation with underscores, strips certain leading or trailing dots and spaces, trims the name and limits it to 120 UTF-16 code units. If nothing remains, it falls back to decoded.bin. The displayed name is the proposed download name; browser and operating-system rules can still affect the final saved name.
An extension labels content for other software; it does not change the content. Naming arbitrary bytes photo.png cannot turn them into a PNG. Likewise, .pdf cannot repair a damaged document, and .zip does not compress anything. Ask the sender for the original type when it is unknown. This tool has no format detector, and a data URL’s media label is not verified against the bytes.
The download preserves binary content
The decoded byte array becomes a Blob with the content type application/octet-stream. This binary type is used even if a data URL says text/plain or the chosen extension is .png. Download file creates a temporary object URL and asks the browser to download it under the proposed name. The workspace itself does not preview, open or execute the recovered file.
Each download click schedules its temporary object URL to be revoked after 60000 milliseconds. That cleanup does not delete a saved file or remove the decoded result from the page. You can click Download file again while the result remains available. The browser may ask where to save or apply its download settings; a visible result on the page is not proof that a save completed.
MDN: Blob constructorMDN: URL.createObjectURL()MDN: HTMLAnchorElement.download
Know which edits keep the result
Changing the Base64 input clears the previous result and any old validation error. A rejected oversized edit is the exception to accepting new text: the previous input remains, the old result is cleared and an error is shown. Pressing Decode file also clears the old result before validating. If decoding fails, an earlier file is not left available as though it matched the new input.
Changing File name after a successful decode keeps the same bytes and updates the proposed download name. You do not need to decode again just to rename the file. Processing is synchronous and has no progress percentage or Cancel control. The workspace keeps no saved-job history; keep the original encoded value or a verified download before reloading or leaving the page.
Separate encoding errors from file problems
A validation error means the input failed one of the tool’s checks, not necessarily that the original file was damaged. First confirm that you copied the complete value rather than a URL, quoted field or log line. Then check size, unsupported whitespace, mixed alphabets and padding. If you cannot reconcile the value with its source, request a fresh copy rather than making speculative edits.
A successful decode can still produce an incomplete or unusable file. Losing complete groups of Base64 symbols can leave valid syntax, and the bytes may already describe damaged, encrypted or unsupported content. Compare the displayed count with an expected count supplied separately. When the sender provides a hash through a trusted channel, a separate hash tool can help compare content; this workspace does not calculate or validate one.
| Symptom | Possible reason | Useful next step |
|---|---|---|
| Generic validation error | Oversized input, unsupported form, symbols or padding | Inspect the original raw value and the stated input rules. |
| File downloads but will not open | Wrong extension, incomplete bytes, encrypted content or an unsupported format | Confirm the original format and expected size with the sender. |
| A renamed file still does not work | Renaming did not alter the bytes | Use a real format converter only after identifying the source type. |
| No Download file button after editing | The old result was cleared | Validate the intended input again before downloading. |
Local decoding does not establish trust
Validation, decoding and preparation of the download occur in the current browser tab. The implemented workflow does not upload the pasted Base64 or recovered file to a decoding server. Loading the site still involves ordinary page assets, and site analytics can make separate requests. This is a description of the processing path, not a promise of zero network traffic or permanent offline availability.
Base64 is reversible encoding, not encryption or a digital signature. Decoding does not authenticate the sender, scan for malware or establish that opening the file is appropriate. Use content from a source you trust and verify it through your normal workflow. Local processing also does not promise secure erasure of browser memory or deletion of files you have saved.
Frequently asked questions
How do I save Base64 as a file?
Paste the complete value, choose a filename and press Decode file. Check the decoded byte count, then select Download file. Decoding and saving are separate actions.
Can I use URL-safe Base64 or omit padding?
Yes, when the value is valid under the supported rules. Standard and URL-safe forms are accepted, with correct padding or without padding. Mixing their special symbols, malformed final groups and nonzero pad bits are rejected.
Does a data URL choose the downloaded file type?
No. The supported Base64 wrapper is removed and its media label is ignored. The Blob uses application/octet-stream, and you choose the filename. The tool does not verify the file format.
What is the maximum input size?
At most 16777216 UTF-16 code units before cleanup, including any header and whitespace. The decoded output must be nonempty and at most 12582912 bytes, or 12 MiB.
What happens if I paste too much text?
The oversized edit is rejected, the previous input remains and an error is displayed. The old download is cleared. The tool does not silently keep a shortened prefix of the attempted edit.
Which whitespace can appear inside the Base64?
ASCII space, tab, line feed, carriage return and form feed are removed inside the payload. Other internal whitespace, including a nonbreaking space or vertical tab, is rejected. Surrounding whitespace is trimmed separately.
Why is Zh== rejected if another decoder accepts it?
It contains nonzero unused pad bits. This tool requires canonical bits after normalization; Zg== is the accepted padded representation of the byte for f.
Does changing .bin to .png convert the file?
No. Changing an extension only changes the proposed name. Use an extension matching the original bytes; the tool does not create a new image or document format.
Can I rename a result without decoding again?
Yes. Editing the filename preserves the decoded bytes and updates the proposed download name. Editing the Base64 input clears the old result.
Can a successful decode still produce a broken file?
Yes. Valid Base64 can represent incomplete, damaged, encrypted or unsupported content. Compare an independently supplied expected size or trusted hash when available; this workspace does not check file integrity.
Are my input and decoded bytes uploaded?
The implemented decoder handles them in the browser tab without an upload step. The page can still load assets and make ordinary site requests, so local decoding does not mean the whole site makes no network requests.
Does the file disappear after sixty seconds?
No. The temporary object URL created for a download is scheduled for cleanup after sixty seconds. That does not delete a saved file or expire the retained decoded result; another download click can create a new object URL.