How to convert File to Base64
Convert local file bytes to ASCII Base64 for a data field, fixture or controlled embed. Optionally include a MIME type prefix for a data URL.
- Select one file and decide whether to enable Include MIME type prefix.
- Encode and copy the complete result, including its prefix when needed.
- Select Convert and review the result.
Example use
Embed a small icon in a demonstration that needs a self-contained data URL, or prepare a binary fixture for a JSON test.
Output and compatibility
Base64 increases the storage requirement by roughly a third, and displaying a large encoded file can use extra browser memory. The MIME type prefix depends on the file type available to the browser. The encoding is reversible without a key.
Troubleshooting
If the target rejects it, check whether it expects raw Base64 or a data URL and confirm the MIME type. Avoid inline encoding of huge assets when an ordinary local-file path works.
Use Base64 to File to recover the file or Base64 Encode for text.
Frequently asked questions
Does file conversion preserve all bytes?
Base64 encodes the selected bytes and can be decoded back to them.
Is this encryption?
Any compatible decoder can read the encoded bytes.