Skip to main content
L
Loopaloo
Buy Us a Coffee
All ToolsImage ProcessingAudio ProcessingVideo ProcessingDocument & TextPDF ToolsCSV & Data AnalysisConverters & EncodersWeb ToolsMath & ScienceGames
Guides & BlogAboutContact
Buy Us a Coffee
L
Loopaloo

Free online tools for developers, designers, and content creators. Your files are processed in your browser and are never uploaded - no accounts required. A few network utilities (like What's My IP and Currency Converter) call public APIs to do their job and say so on their pages.

support@loopaloo.com

Tool Categories

  • Image Tools
  • Audio Tools
  • Video Tools
  • Document & Text
  • PDF Tools
  • CSV & Data
  • Converters
  • Web Tools
  • Math & Science
  • Games

Company

  • About Us
  • Contact
  • Blog
  • FAQ

Legal

  • Privacy Policy
  • Terms of Service
  • Disclaimer

Support

Buy Us a Coffee

© 2026 Loopaloo. All rights reserved. Built with privacy in mind.

Privacy|Terms|Disclaimer
  1. Home
  2. Image Processing
  3. Image to Base64
Add to favorites

Image to Base64

Turn an image into Base64 text or a data URL to embed in HTML, CSS or Markdown, checked to decode back to your exact file. Optional resizing first.

Edits stay in your browserMore image processingJump to full guide

Initializing in your browser…

You might also like

Image Format Converter

Convert images between PNG, JPEG, WebP, GIF and BMP (and AVIF where your browser supports it), one at a time or in a batch, and compare how big each format makes your picture.

Image Resizer

Resize one photo or a whole batch to exact pixels, a percentage or a social media preset, with fit, fill and crop, or stretch, and save as JPEG, PNG or WebP.

Image Cropper

Crop a photo by dragging a box or typing exact pixels, with aspect ratio presets, quarter turns, mirrors and shape cut-outs. PNG output keeps every pixel exactly.

Image to Base64: a worked example

The sample icon, a 96 by 96 PNG of 7,470 bytes, encoded as a data URL.

File

icon-96.png, 7,470 bytes
Width: Original
What Image to Base64 produces

Result

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABg...

Base64: 9,960 characters
Data URL: 9,982 characters (+33.6%)
Decodes back to all 7,470 bytes: yes

Base64 writes every 3 bytes as 4 characters, so 7,470 bytes become 9,960 characters, and the data: prefix adds 22 more. That third extra is the price of embedding: the icon needs no separate download, but it cannot be cached apart from the page. The text was decoded again and matches the file byte for byte, and the image/png type comes from the file itself, not its name.

About Image to Base64

Convert an image into Base64 text you can paste straight into code: a data URL for an img tag or a CSS background, plain Base64, or ready-made HTML, CSS and Markdown snippets. It is the quickest way to embed small icons and logos without a separate file.

How to use

  1. 1Drop in an image, paste one, or press Try a sample icon.
  2. 2Choose Data URL, Base64, CSS, HTML or Markdown.
  3. 3Optionally make a large picture smaller first.
  4. 4Press Copy, or download the text as a .txt file.
  5. 5Paste it into your HTML, CSS or Markdown.

Where this helps

  • Web development

    Embed small icons and sprites to save requests.

  • Email templates

    Include logos that show even when external images are blocked.

  • Single-file documents

    Keep images inside HTML or Markdown files that must travel alone.

  • APIs and JSON

    Send images as text in data formats that only carry strings.

Key features

  • Data URL, plain Base64, CSS, HTML and Markdown outputs
  • Readable SVG text output for SVG files
  • Checked to decode back to your exact file
  • Image type taken from the file content, not its name
  • Optional resizing with quality and filter settings
  • Size, character count and overhead shown
  • Preview drawn from the encoded text
  • Copy or download as text
  • Shareable settings link; nothing is uploaded

Tips & best practices

  • Compress or resize images before embedding to keep pages light.
  • Use the SVG text output for icons in CSS; it is shorter and easy to edit.
  • Keep embedded images under a few kilobytes each.
  • Use the Base64 output when an API asks for the image without the data: prefix.

Examples

  • An inline icon

    The 96 by 96 sample icon of 7,470 bytes becomes a 9,982 character data URL, 33.6 percent larger than the file.

  • A CSS background

    Choose CSS to get a background-image rule for a small pattern or logo, ready for a stylesheet.

  • An email signature logo

    Resize the logo to 128 pixels first, then use the HTML output so the image travels inside the message.

How it works

Five outputs. Data URL gives the complete data: address. Base64 gives only the encoded text. CSS gives a background-image rule, HTML an img tag and Markdown an image line, each with the data URL inside. For SVG files there is a sixth, SVG text, which writes the drawing as readable, escaped text instead of Base64 and is usually shorter.

Exactly your file. By default the file is encoded as it is, byte for byte, and the result is decoded again and compared with your file before you copy it. The image type in the data URL comes from the file's own first bytes, so a PNG that was renamed .jpg is still labelled image/png and displays correctly; the page warns you when the name and the content disagree.

Smaller first, if you want. Under Make it smaller first, pick a width (64, 128, 256, 512 or 1024 pixels, or any width) to scale a large picture down before encoding, with a quality setting for JPEG and WebP and a choice of scaling filter. The page then says clearly that the result is a resized copy, not your original file.

What it costs. Base64 turns every 3 bytes into 4 characters, so the text is about a third larger than the file, and an embedded image cannot be cached separately from the page it is in. The page shows the file size, the number of characters and the exact percentage. Embedding suits small icons, logos and simple graphics; for large photos a normal image file is usually better. Copy the result or download it as a text file. Everything runs in your browser.

Frequently asked questions

What is a data URL?

An address that contains the file itself instead of pointing to it, for example data:image/png;base64, followed by the encoded image. Browsers display it like any other image.

Why is the Base64 text bigger than my file?

Base64 uses 4 characters for every 3 bytes, so it is about a third larger. The page shows the exact difference.

When should I embed an image?

For small images such as icons and logos, where saving a separate download matters more than caching. For large photos, link to a normal image file instead.

Does resizing change my image?

Yes: a resized copy is a new, smaller picture saved again. Leave the width on Original to encode your file exactly.

Can I encode SVG?

Yes. You also get an SVG text option that keeps the drawing readable and is usually shorter than Base64.

Is my image uploaded?

No. The encoding happens in your browser.

Related tools and how they differ

  • Base64 Encoder/Decoder: Encodes and decodes Base64 for any text or file.
  • Image Compressor: Makes a picture smaller before you embed it.
  • SVG Optimizer: Cleans up SVG files, which can then be embedded as short text.

Private by design

Images are decoded, edited, and exported entirely inside this browser tab. No originals, exports, or metadata are uploaded.