How to convert a file to Base64
- Drop a file onto the box or click to choose one from your device.
- Choose raw Base64, a data URI with the MIME type, or a JSON object.
- Copy the result or download it as a .txt file.
Typical uses for developers
- Sending files to REST or GraphQL APIs inside JSON.
- Embedding fonts in CSS with
@font-face { src: url(data:font/woff2;base64,…) }. - Storing certificates and config files in Kubernetes secrets or environment variables.
- Writing test fixtures without separate binary files.
Command-line alternatives
Linux: base64 -w 0 file.zip. macOS: base64 -i file.zip. Windows: certutil -encode file.zip out.txt or PowerShell [Convert]::ToBase64String([IO.File]::ReadAllBytes('file.zip')).
Frequently asked questions
Which file types are supported?
All of them. Base64 works on raw bytes, so any file can be encoded: PDF, DOCX, ZIP, MP3, MP4, fonts, executables and more.
Are my files uploaded?
No. The file is read and encoded by your own browser. It never leaves your computer or phone.
Why add a data URI prefix?
The prefix tells browsers and other programs which type of file the Base64 contains, so it can be used directly in HTML, CSS or Markdown.