A lightweight Svelte utility that instantly converts local files into Base64 Data URLs. It handles the conversion, calculates the size overhead, and provides a one-click copy solution for your development workflow.
Try it out on: https://tamashalasi.com/file-to-data-url/
Why convert files to Base64 strings? Here are a few common scenarios:
Single-file HTML distribution: Embed images and scripts directly into an HTML file so you can share a standalone document (e.g., email templates, offline reports) without needing a folder of assets.
Performance optimization (small assets): Reduce HTTP requests by embedding tiny icons, logos, or noise textures directly into your CSS or HTML.
.icon {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJ...');
}
If you want to run this project locally or contribute:
Clone the repository
Install dependencies
pnpm install
Start the development server
pnpm run dev