Tools Hub

Embed a small picture directly in markup

Inline a tiny image as Base64 text: encode the file, keep the media type correct and verify the data URL decodes back into the same picture.

Browser onlyYour data never leaves this device.

Every tool named on this page runs in your browser; nothing you paste or open is uploaded.

Details: Privacy policy

Draft job page — noindex and awaiting human review before publication.

Formats this job covers

  • png
  • base64

Tools used in this job

  • Image to Base64 — Turn a PNG, JPEG, WebP, or GIF into a Base64 data URL or raw text without uploading it.
  • Base64 to Image — Decode a data URL or raw Base64 string back into a verified PNG, JPEG, WebP, or GIF image.

A handful of situations reward inlining an image as text rather than linking a file: an email signature that must survive aggressive filters, a single-file HTML demo that has to travel as one document, or a stylesheet that should not add another request. The trade-off is honest and easy to get wrong. Text is roughly a third larger than the bytes it carries, so this suits small icons and logotypes, not photographs. This job is the round trip: encode the picture, keep the declared media type truthful, then decode the generated string back into an image to prove it survives. Because the conversion is text, it can also be pasted anywhere a file cannot travel, including a configuration file or a chat message, without ever touching a server. Size decides whether inlining is sensible. A mark, a favicon or a simple diagram becomes a short string that costs almost nothing to carry, while a photograph turns into an enormous block of text that delays rendering and inflates every copy of the file. Measure before committing: encode the candidate, look at the length of the generated string, and compare it with the weight of a linked asset plus one request. Keep the declared media type truthful, because a browser trusts the label and a mismatch produces a broken image with no useful error. Verify the round trip by decoding the string back into a picture, which catches a truncated paste or a stray line break. Anyone can reverse the encoding, so secrets never belong in markup. Accessibility does not disappear because the picture travels as text. A description reached through a screen reader comes from the markup attribute, not from the encoding, so write the alternative text wherever the picture appears. Keep the inlined asset out of the critical path where you can, and remember that a large string is parsed on every device that loads it. If the picture is decorative, mark it as such rather than leaving the attribute empty out of haste, and prefer a small vector when the shape is simple. When a picture changes, re-encode rather than editing the string by hand, because one altered character invalidates the whole payload. Prefer an ordinary file reference wherever the markup allows one; inlining is a fallback, not a default.

How to use Embed a small picture directly in markup

  1. Choose the smallest version of the picture; inlining a photograph is rarely worth it.
  2. Encode the file and copy the generated data URL or raw Base64 string.
  3. Paste it into the markup or configuration where a file reference would normally appear.
  4. Decode the string back into an image to confirm the bytes and media type are intact.

What you get

  • Encoding handles PNG, JPEG, WebP and GIF input up to the documented size cap.
  • Decoding validates the Base64 alphabet strictly and refuses characters outside it instead of guessing.

When to use Embed a small picture directly in markup

  • Add a logo to an email template that a strict filter would otherwise strip.
  • Ship a single-file demonstration page with no external requests.
  • Decode an opaque data URL from a log to see which picture it contains.

Frequently asked questions about Embed a small picture directly in markup

Does inlining make a file smaller?

No. Base64 text is about a third larger than the original bytes. It removes a request, not weight.

Which pictures suit inlining?

Small icons, marks and simple shapes. Photographs become enormous strings and are better served as files.

Is Base64 encryption?

No. Base64 is an encoding anyone can reverse, so never use it to hide something sensitive.

How do I check a data URL I was given?

Decode it back into an image. A wrong media type or a corrupted string is visible immediately as a failed decode.

Can I inline a picture in a configuration file?

Yes, provided the file accepts a long text value. Keep the string on one line, avoid inserting line breaks when pasting, and note beside it which picture it represents, because a reviewer cannot identify an image from a wall of encoded characters.

Feedback

Send feedback about this tool (placeholder — feedback collection is not wired up yet).