File to Base64 / Base64 to File
Turn any file into a Base64 string or a data URI, and turn Base64 back into a downloadable file.
Upload a file
Base64 → file
File to Base64, and back again
Pick any file and it is read locally with the FileReader API — the bytes never leave your device. You get the raw Base64 string and a complete data: URI with the correct MIME type already filled in.
A data: URI can be pasted straight into an <img src>, a CSS background, or a JSON field, which is why it is the usual way to inline a small icon and save a network request.
When inlining is a good idea — and when it is not
- Good for small assets: icons, logos, tiny placeholder images under a few kilobytes.
- Bad for large files: the 33% size increase is paid on every page load, and inlined data cannot be cached separately from the page.
- Email clients are the classic exception — many block remote images but render inlined ones.
Frequently asked questions
Is there a file size limit?
Only your device memory. The file is held in browser memory while encoding, so very large files (hundreds of megabytes) may be slow or fail on low-memory devices.
Is my file uploaded anywhere?
No. The file is read locally with FileReader and encoded in the page. There is no network request involved at any point.
Related tools
Base64 EncodeEncode text or files to Base64, with standard or URL-safe alphabets and optional line wrapping.Base64 DecodeDecode Base64 back to text, choosing the character set (UTF-8, EUC-KR, Shift_JIS, GBK…) so the result reads correctly.Hex EncodeConvert text to hexadecimal (Base16) with a choice of separator, casing and source character set.