Skip to content
nestoo
  • What is my IPYour public IPv4 and IPv6 address, location and provider.Network & IP
  • Speed testMeasure your download and upload speed, latency and jitter.Network & IP
  • IP lookupLocation, provider and network of any IP address.Network & IP
  • DNS lookupA, AAAA, MX, TXT, NS and other DNS records for any domain.Network & IP
  • WHOIS lookupOwner, registrar and expiry date of any domain or IP.Network & IP
  • Prefix lookupCheck a prefix in BGP, RPKI and the IRRs before you announce it.Network & IP
  • ASN lookupOwner, announced prefixes and neighbours of any AS number.Network & IP
  • Subnet calculatorNetwork, broadcast, host range and mask of any IPv4 or IPv6 subnet.Network & IP
  • Port checkerCheck whether a port is open on your IP or a server.Network & IP
  • HTTP headers checkerResponse headers, status codes and redirect chain of a URL.Network & IP
  • SSL checkerCertificate validity, expiry and chain of any website.Network & IP
  • SPF, DKIM and DMARC checkerCheck a domain’s SPF, DKIM and DMARC records for mistakes.Network & IP
  • Password generatorStrong, random passwords generated right in your browser.Passwords & security
  • Password strength checkerHow long a password would take to crack, and if it leaked.Passwords & security
  • Hash generatorMD5, SHA-1, SHA-256, SHA-512 and CRC32 hashes of text or files.Passwords & security
  • JSON formatterFormat, validate and minify JSON, with exact error locations.Developer tools
  • Base64 encoder/decoderEncode text or files to Base64 and decode it back.Developer tools
  • URL encoder/decoderEncode and decode URLs and query strings, and parse any URL.Developer tools
  • JWT decoderRead the header and claims of a JSON Web Token.Developer tools
  • UUID generatorRandom UUID v4 and time-ordered v7 identifiers.Developer tools
  • Unix timestamp converterConvert Unix timestamps to dates and dates to epoch time.Developer tools
  • Binary converterTranslate text to binary and convert between number bases.Developer tools
  • Image compressorMake JPG, PNG, WebP and AVIF files smaller, many at once.Image tools
  • Image resizerResize images to exact pixels or by percentage, many at once.Image tools
  • Image converterConvert HEIC, PNG, WebP, AVIF and more to JPG, PNG, WebP or AVIF.Image tools
  • Crop imageCrop, rotate and flip images to any size or aspect ratio.Image tools
  • EXIF viewer and removerSee the hidden data in photos, including location, and remove it.Image tools
  • Favicon generatorTurn a logo into favicon.ico, Apple touch icon and app icons.Image tools
  • Image to Base64Turn images into Base64 data URIs, and data URIs back into images.Image tools
  • Word counterCount words, characters, sentences and reading time.Text tools
  • Case converterUPPERCASE, lowercase, Title Case, camelCase, snake_case and more.Text tools
  • Diff checkerCompare two texts and highlight the differences.Text tools
  • QR code generatorFree QR codes for links, text, Wi-Fi and contacts, as PNG or SVG.Everyday tools
  • Percentage calculatorPercent of a number, percentage change, increase and decrease.Everyday tools
  • Unit converterConvert length, weight, temperature, volume, data and more.Everyday tools

Image to Base64 converter

Turn an image into a Base64 data URI with ready-to-paste HTML and CSS, or paste a data URI to get the image back as a file. Nothing is uploaded: it all happens in your browser.

Drop an image here

Or paste from the clipboard. JPG, PNG, WebP, AVIF, HEIC, GIF and SVG work.

Runs in your browser. What you enter never leaves your device.

How to use it

  1. 1.To encode, keep “Image to Base64” selected and drop an image on the page, paste one from the clipboard, or click “Choose an image”.
  2. 2.Copy the version you need: the data URI for an src or url(), plain Base64 for an API, or the ready-made HTML tag or CSS rule. SVG files also get a shorter URL-encoded data URI.
  3. 3.To decode, switch to “Base64 to image” and paste a data URI or plain Base64. CSS or HTML that contains one works as well.
  4. 4.Check the preview, format and size, then click Download to save the image with the right file extension.

What a data URI is

A data URI puts a whole file inside a URL, so a page can show an image without a separate download. The syntax is data:[<media type>][;base64],<data>, for example data:image/png;base64,iVBORw0KGgo…. The media type tells the browser what the data is; ;base64 says the data is Base64-encoded rather than URL-encoded text.

Base64 writes every 3 bytes of the file as 4 plain ASCII characters, which is why the result is about a third larger than the image. Gzip and Brotli win back part of that when the page is sent, but the browser still has to decode the full text.

When inlining an image helps, and when it hurts

Inlining pays off for very small images: icons, tiny backgrounds and placeholders of a kilobyte or two, where a separate request would cost more than the bytes. It’s also handy for single-file HTML reports, test fixtures, and APIs or JSON documents that expect an image as text.

For anything larger it usually makes pages slower. The image can’t be cached on its own, so it is downloaded again with every page or stylesheet that contains it; in CSS it also delays rendering, because the browser waits for the whole stylesheet. Over HTTP/2 extra requests are cheap, so a normal image file is the better choice above a few kilobytes.

Email is a special case: Gmail and Outlook don’t display data URI images, so newsletters should link hosted images or attach them as inline (CID) attachments instead.

A shorter data URI for SVG

SVG is text, so it doesn’t need Base64 at all. A URL-encoded SVG data URI such as data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg'… is usually 15 to 25 % shorter, compresses better and stays readable in your CSS.

Only a few characters have to be escaped: <, > and above all # (written %23), which would otherwise end the URL, for example in a colour like fill='%23f00'. This tool also collapses whitespace and switches to single quotes so the URI fits inside url("…") without further escaping.

Questions and answers

Is my image uploaded anywhere?

No. The image is read and encoded by your browser on your own device, and pasted Base64 is decoded there too. Nothing is sent to nestoo or anyone else.

Why is the Base64 version bigger than the image file?

Base64 represents each 3 bytes with 4 characters from a 64-character alphabet, so the text is about 33 % larger than the file, plus the short data:image/…;base64, prefix. That’s the price of storing binary data as plain text.

How do I use a data URI in HTML, CSS, Markdown or JSON?

In HTML, put it in the src of an image: <img src="data:image/png;base64,…" alt="">. In CSS, use it in url(): background-image: url("data:…");. In JSON it’s an ordinary string; many APIs want only the Base64 part without the data: prefix. Markdown accepts ![alt](data:…) in principle, but GitHub and many other sites strip data URI images, so link a hosted image there.

How big can the image be?

The tool encodes images up to 20 MB, and browsers can display data URIs of several megabytes. In practice, keep inlined images to a few kilobytes: larger ones bloat your HTML or CSS and can’t be cached separately.

How do I turn a data URI back into an image file?

Switch to “Base64 to image” and paste the data URI or the bare Base64. The tool detects the real format from the data itself, shows a preview and saves the file with the correct extension, even if the URI claimed a different type.