What is Base64?
Base64 is a way to represent binary data (like an image) as an ASCII string. This allows you to embed images directly into HTML or CSS files without making an extra HTTP request.
When to use it:
- Small Icons: Embed UI icons directly in CSS to speed up page load.
- Emails: Some email clients block external images; Base64 bypasses this.
- Single-File Scripts: Create self-contained HTML files with no external dependencies.
Warning:
Base64 string adds about 33% to the file size. Do not use it for large photos.