Example
Input (image file)
icon.png (4.2 KB, 32×32)
Output (data URI)
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg...
Note
Inline-friendly in HTML / CSS / Markdown. Base64 inflates size by ~33%, so this is best for small images (or SVG handled separately).
Usage / FAQ
When to use
- Inline tiny icons or logos in CSS / HTML to skip HTTP requests
- Embed images in email, Markdown, or Notion without external hosting
- Generate data URIs for favicons or avatar placeholders
- Embed static images in PWAs or Electron apps
- Include image bytes in test fixtures
FAQ
- Q.Can I encode large images?
- A.Technically yes, but don't. Base64 adds 33% (1 MB → 1.33 MB) and you lose browser caching. Use this for ~10 KB or smaller.
- Q.What about SVG?
- A.SVG is text — URL encoding can be smaller than Base64 (`data:image/svg+xml,<svg ...>`). Some environments (CSS background-image) prefer Base64 for safety.
- Q.Is the file uploaded anywhere?
- A.No. Files are read with FileReader in the browser only — nothing leaves your device.
Fun facts
The `data:` URI scheme was standardized in 1998 as RFC 2397. Forms like `data:image/png;base64,iVBOR...` let you inline small images directly inside HTML or CSS — no separate HTTP request needed.
RFC 2397 (1998)The size cost of base64 inlining — encoded data grows by about 33% (3 bytes → 4 ASCII characters). A 5 KB PNG becomes a ~6.7 KB data URI, and it can't be cached separately (it's part of the HTML). For larger images, a separate file is dramatically more efficient.
Wikipedia — Data URIInlining was valuable in the HTTP/1.1 era as a request-saving trick — but HTTP/2 multiplexing eroded that benefit. The current guidance is: only inline tiny icons (< 1 KB) and keep everything else as separate files, so caching, gzip, and HTTP/2 push can do their work.
MDN — data URI scheme
Related guides
- Base64 Encoding — How It Works and When to Use It
Base64 is binary-to-text encoding, not encryption. Understand padding, URL-safe variants, common pitfalls, and the encoded size overhead.
- Image Optimization for the Web — WebP, AVIF, srcset, and the Right Compression
Modern image formats compared, when to pick JPEG vs WebP vs AVIF, responsive images with srcset, lazy loading, and how compression actually works.
- SVG Optimization — From 50KB Editor Export to 5KB Production-Ready
Why editor exports balloon, what SVGO removes, when to inline vs reference, sprite sheets, and the security checklist for user-uploaded SVGs.
- How Image Compression Actually Works (PNG, JPG, WebP, AVIF)
What's inside a JPEG, why PNG is lossless, how WebP and AVIF squeeze further without visible loss. Discrete cosine transform, Huffman coding, palette indexing, and the trade-offs each format makes.
- How File Magic Numbers Work
How operating systems and browsers identify file types from their first few bytes — PNG, JPG, PDF, ZIP signatures, the gotchas of trusting filename extensions, and why content-sniffing is both useful and dangerous.
Related tools
- Color Converter
Convert colors between HEX, RGB, and HSL with a live preview swatch. Auto-detects any of the three input formats.
- Image Resize & Compress
Resize, crop, and compress images entirely in your browser. Pick width × height, choose crop or fit mode, adjust JPEG quality. Outputs as {original}_{w}x{h}.{ext}.
- Image Crop
Crop images right in your browser — drag to select, lock aspect ratios (1:1, 16:9…), export PNG/JPEG. No upload.
- Emoji Picker
Pick and copy emojis with one click. Search by name (en/ko), browse by category, and keep your recents and favorites in the browser.
- QR Code Generator
Generate a QR code from any text or URL. Adjustable error correction (L/M/Q/H), SVG output, downloadable.
- Color Contrast Checker
Check the WCAG contrast ratio between two colors. Pass/fail for AA Normal/Large + AAA Normal/Large with a live sample.
- Color Palette Generator
Generate a palette from a single base color — shades, tints, complement, analogous, triad, tetrad. HSL-based. 0 dependency.
- CSS Gradient Generator
Build linear, radial, and conic CSS gradients with color stops + angle/position. Live preview + copy-ready CSS.
- PDF Merge
Merge multiple PDF files into a single document. Drag to reorder pages, all client-side — files never leave your browser.
- PDF Split
Extract a page range from a PDF — e.g. 1-3,5,7-9. All client-side, files never leave your browser.
- PDF Rotate
Rotate all or selected PDF pages by 90°, 180°, or 270°. Useful for scanned documents in wrong orientation. All client-side.
- PDF Watermark
Add a text watermark (CONFIDENTIAL, DRAFT, etc.) to every PDF page. Control opacity, rotation, size, color. All client-side.
- PDF Compress
Re-encode a PDF with object stream compression and metadata stripping. Modest size reduction (text-heavy: 5-20%). Image-heavy PDFs need server-side tools. All client-side.
- Image to PDF
Combine JPG, PNG, and other images into a single PDF — in your browser. Reorder pages, choose A4/Letter or original size. Nothing is uploaded.
- Favicon Generator
Make a favicon from an image, emoji, or text — multi-size favicon.ico, apple-touch-icon, PWA icons + ready HTML/manifest snippets, in your browser.