Image to Base64 Converter

Convert image to base64 online — from a local file, a drag-and-drop, a paste, or an image URL. Get a Data URI and a raw base64 string instantly, with nothing ever uploaded.

Choose an image

0 files
Drag an image here, or click to browse
Supports JPG · PNG · GIF · WebP · SVG, or paste with Ctrl+V

Note: online images must allow cross-origin reads. If it fails due to CORS, download the image and use local upload instead.

Conversion result

Waiting for an image
Pick or drop an image and the converted result will appear here…
You get clear feedback on both success and failure

Convert image to base64 in three ways

Three ways in, one consistent result — and the same numbers reported for every one of them.

Everything this converter does starts the same way: it reads the image’s bytes and re-expresses them as ASCII text. Whether those bytes come from a file picker, a drag, the clipboard or a remote address, the same encoding path runs. That is why the size figures above the result are directly comparable no matter how the image arrived — you are never comparing a measured value against a guessed one.

Option 1

Pick a file

The standard file dialog, filtered to images. Selecting several files processes them as one batch and keeps each entry in the result list.

Option 2

Drop or paste

Drop images anywhere on the page, or press Ctrl+V (Cmd+V on macOS) to paste straight from the clipboard — handy for screenshots that were never saved to disk.

Option 3

Load from an address

Convert image URL to base64 by pasting a link. This path measures the real byte length too — see the section below for what happens when a host blocks cross-origin reads.

Convert image URL to base64

Fetching an image from another origin is the only part of this tool that can fail for reasons outside your control, so it fails loudly and explains itself.

The converter tries two strategies in order. The first is a plain fetch request, which is preferred because it hands back the exact byte length — the original size and the size increase you see are measurements, not estimates. The second is loading the image through an <img> element and drawing it onto a canvas, which works when the host allows cross-origin reads but a direct fetch was blocked.

If the host forbids cross-origin access, the browser refuses to hand over the pixel data and both strategies fail. That refusal is a browser security policy, not a bug in the tool, and no amount of client-side code can work around it. When it happens, you get a specific explanation and a concrete next step: download the image and use local upload, where there is no origin boundary to cross in the first place.

Why the fallback re-encodes to PNG. A canvas can only export the pixels it holds, not the original container. Images loaded through that path come back as PNG, so their reported base64 size is approximate and the format shown is PNG even if the source was a JPEG. The direct fetch path has no such caveat.

What happens to an image URL, step by step
StepWhat the tool does
NormaliseTrims whitespace and adds https:// when a bare hostname is entered, so example.com/pic.png and https://example.com/pic.png both work.
FetchRequests the bytes with credentials omitted. A non-image content type is rejected before any encoding happens.
VerifyThe container format is detected from the file’s magic bytes rather than trusted from the response header, so the data URI prefix can never disagree with the payload it introduces.
EncodeBytes are converted to base64 in fixed-size chunks, which keeps very large images from exhausting the call stack.

Image to base64 online, with nothing uploaded

“Online” here means no install and no sign-up — not that your file takes a trip through someone else’s disk.

Most converters on the web upload your image to a server, encode it there and send the text back. This one does not. The file is read with the browser’s own FileReader API and encoded in page memory, so the bytes never leave the machine. That is not a marketing claim you have to take on faith: open your browser’s network panel while converting and you will see no request carrying your image.

The practical consequence is that the tool is usable for material you would not comfortably hand to a third party — internal screenshots, client work, images with metadata attached — and that there is no file size ceiling imposed by an upload limit or a conversion queue.

Local by design

No upload, no queue, no quota

Conversion speed is bounded by your own disk and CPU, and there is no per-day limit because there is no server counting requests.

Verifiable

Check it yourself

Open DevTools, switch to the Network tab, and convert an image. Nothing carrying the file leaves the page.

What base64 encode actually does to a file

Base64 exists to carry binary data through channels that only accept text. The cost is a predictable amount of bloat.

The encoding takes 3 bytes of binary data — 24 bits — and splits them into 4 groups of 6 bits, each of which maps onto one of 64 printable ASCII characters. So every 3 bytes become 4 characters: a fixed 4/3 ratio, or about 33% growth. When the input length is not divisible by 3, the final group is padded with one or two = characters to keep the total a multiple of 4.

Measured effects you can see in the result panel
EffectDetail
Payload growthRoughly +33%, from the 4/3 character mapping. A 248 KB PNG becomes about 331 KB of text.
Data URI prefixThe data:image/png;base64, header adds a fixed 22 characters when you copy the prefixed form rather than the raw string.
Transfer costText compresses well, so over gzip or brotli an inlined image often costs far less than the raw base64 suggests.
CachingThis is the real trade-off. An inlined image cannot be cached separately from the document that carries it, so it is re-sent every time that document is.

When a data URI is the right call

  • Small icons and logos that would otherwise each cost a separate round trip.
  • CSS that must be self-contained — an email template, a single-file widget, or a component library shipped as one asset.
  • Images you need to generate at runtime — a canvas export that has to travel as a string rather than a file.

When it is not

  • Photographs and large artwork. The 33% overhead compounds with the loss of separate caching and of progressive decoding.
  • Anything above roughly 10 KB per asset. Beyond that a separate request is almost always the cheaper option.
  • Content that changes independently of the page embedding it, since every change now invalidates the whole document.

Supported formats and limits

Accepted inputs
FormatNotes
JPG / JPEGDetected by the FF D8 marker; the usual choice for photographs.
PNGLossless, supports transparency, and the format the canvas fallback exports.
GIFEncoded from the original bytes; only the first frame is previewed inline.
WebPDetected via the RIFF…WEBP header.
SVGRead as text, so the payload matches the original markup byte for byte — no binary round-trip to corrupt it.
BMP / ICOEncoded from the original bytes and previewed as-is.

Boundaries

  • 10 MB per file. Larger files are refused with the actual size shown, rather than failing silently halfway through.
  • 20 files per batch, with the most recent 30 kept in the result list.
  • Cross-origin images need the host’s permission. Without CORS headers the browser blocks the read, and the tool says so instead of returning a broken string.

Frequently asked questions

How do I convert an image to base64?

Drag an image onto the drop zone, click to browse for a file, or paste straight from the clipboard with Ctrl+V (Cmd+V on macOS). The converter reads the bytes locally and returns the base64 string immediately — there is no upload step and no queue, so the result appears as fast as the file can be read.

How do I convert an image URL to base64?

Paste the image address into the convert image URL to base64 field and press Load. The tool requests the bytes and encodes them directly, which also gives you an exact original size instead of an estimate. If the host does not permit cross-origin reads the browser blocks access; the converter then retries through a canvas element, and if that is blocked as well it tells you to download the image and use local upload instead.

Is this image to base64 converter free, and does it work online?

It is free, needs no account, and runs in any modern browser on desktop or mobile. Because every conversion happens inside the page there is nothing to install, no queue and no conversion quota.

What does base64 encode do to the file size?

Base64 encode maps every 3 bytes of binary data onto 4 ASCII characters, so the encoded text is roughly 33% larger than the original file. The data URI prefix adds a few characters more. The stats row above the result reports the measured figure for your specific image rather than a rule of thumb.

Which image formats can I base64 encode?

JPG, JPEG, PNG, GIF, WebP, BMP, SVG and ICO, up to 10 MB per file. SVG is read as text so the payload stays identical to the original markup, and the format shown in the result is detected from the file's magic bytes rather than trusted from the file name.

What can I do with the Data URI once I have it?

Paste it into an HTML src attribute, a CSS background-image, a markdown image, or a JavaScript string. It is most useful for small icons and logos that would otherwise cost an extra network request; keep it away from large photos, where the 33% overhead and the loss of browser caching usually outweigh the saved request.

Are my images uploaded to a server?

No. The conversion runs in browser memory and the bytes are never transmitted. You can confirm this in your browser's network panel — the only requests are for the page itself.