Back to guides

Image to Base64|Build data URIs for HTML email and JSON fixtures locally

Read images with FileReader in the browser—full data URI or raw Base64, optional prefix strip, files never sent to WoDeTool servers.

By WGinit · November 29, 2026 · 3 min read · 13 views

When Base64 still beats a one-liner script

Marketing wants a tiny icon inside HTML email; mocks need avatarBase64; offline demos cannot hit a CDN. Node one-liners work until the laptop has no Node or paths break on locale.

Image to Base64 picks a file (image/*), runs readAsDataURL locally, and shows copyable output. Include data: prefix keeps data:image/png;base64,...; unchecked returns payload-only for JSON fields that want naked Base64.

Preview, file KB, and character count help you see mock bloat before paste.

Prefix on vs off

With prefix: drop into or CSS url(); MIME comes from the browser's sniff of the file.

Without prefix: for API bodies; server must wrap or decode bytes itself.

Toggling the checkbox recomputes from the last file without re-selecting.

Chain with compress and Base64 tools

Character explosion: compress images under 200KB first, or Image Converter for format tradeoffs.

Reverse or sanity-check chunks in Base64—do not paste user avatars into public channels.

Mock workflows: mock JSON without API; embed small icons, link large assets.

Clipboard flows: Chrome extension guide—data URIs can exceed clipboard limits.

Flow (figure)

Pick image, encode, paste HTML or JSON

Order: small asset → check KB/chars → prefix choice → paste → compress if huge.

Size triage (figure)

Compress, strip prefix, or host externally

Base64 expands roughly 4/3 over binary; fine for KB icons, painful for hundreds of KB in JSON.

Email clients differ on data URIs; large inline HTML hurts deliverability—prefer hosted images in campaigns.

Limits

One file per run—no batch folder encode. readAsDataURL follows the browser image/* picker; exotic formats may fail before encoding.

Rough sizing: under ~15 KB source icons usually stay comfortable in JSON mocks; above ~100 KB plan on Image Compressor or hosted URLs. Character count on the page is a quick guardrail; divide by four for approximate decoded bytes.

CSP img-src must allow data: where you embed URIs. Open Graph and social previews want HTTPS asset URLs, not data URIs—crawlers will not fetch embedded strings.

Paste into JSON through JSON Formatter after copy to confirm escaping; MSW fixtures often want prefix off while HTML email wants prefix on—document which shape your DTO expects.

Privacy

Processing stays in the tab; WoDeTool never receives the file. Base64 still is the image—no IDs or faces in git.

Storing avatars as Base64 in production DBs bloats rows; object URLs remain the scalable pattern.

FAQ

Qvs generic Base64 tool?

AFile picker plus preview and prefix toggle tailored to images.

QSVG?

AUsually within image/*; huge SVGs should stay linked.

QBatch?

ASingle file UI; scripts for bulk.

Worked example

1. 8KB PNG icon → Image to Base64.

2. Prefix on → paste into email img src.

3. Mock needs raw → prefix off → iconBase64; validate size in JSON Formatter.

4. >50k chars → Image Compressor then retry.

5. Decode sample in Base64 before DB insert.

Copy-paste reference

Image to Base64 copies either full data URIs or payload-only; HTML img usually wants the prefix.

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==" alt="1px fixture" />

Related tools

Related guides