Data URI Browser Limits and Compatibility

Complete reference for data URI size limits across browsers. IE 32KB limit, modern browser maximums, mobile browser support, and compatibility testing strategies.

Compatibility

Detailed Explanation

Browser Support and Size Limits

Data URIs have been supported since the early days of the web, but size limits and edge cases vary across browsers and versions.

Browser Size Limits

Browser Maximum Data URI Size
Chrome 120+ ~512 MB (limited by available memory)
Firefox 120+ ~256 MB (limited by memory)
Safari 17+ ~128 MB
Edge (Chromium) Same as Chrome
IE 8 32 KB
IE 9-11 ~4 GB (no practical limit)
iOS Safari ~128 MB
Android Chrome Same as desktop Chrome

The IE 8 32 KB Limit

Internet Explorer 8 was the last major browser to impose a strict 32 KB limit on data URIs. While IE 8 usage is effectively zero today, some enterprise environments and government systems may still require it. If you must support IE 8:

  • Keep all data URIs under 32,768 bytes (including the data: prefix)
  • Use a build tool to measure data URI sizes and warn when approaching the limit
  • Provide conditional comments with external file fallbacks

Practical Considerations

Even though modern browsers support very large data URIs, practical limits are much lower:

  1. Page source readability: Data URIs over a few KB make HTML/CSS unreadable in source view
  2. Build tool performance: Large Base64 strings slow down bundlers and linters
  3. Version control: Base64 changes produce large, unreadable git diffs
  4. Editor performance: IDEs may lag with very long lines (data URIs are single-line)
  5. Copy/paste: Long data URIs are impractical to copy manually

Recommended Maximum Sizes

Context Recommended Max
HTML img src 10 KB (original file)
CSS background-image 4 KB (original file)
CSS @font-face 20 KB (original file)
JavaScript string 10 KB (original file)
Email HTML 5 KB (original file)

Testing Strategy

  1. Test in the oldest browser you support
  2. Measure performance impact on low-end devices
  3. Verify that build tools handle large data URIs correctly
  4. Check that CDN/proxy layers do not strip or truncate data URIs

Use Case

You are writing documentation for a component library and need to specify the maximum file sizes that should be inlined as data URIs based on the project's browser support matrix.

Try It — Data URL Generator & Decoder

Open full tool