Ubah Teks Anda, Berdayakan Kata-Kata Anda

[ID] Image to Base64 Converter

[ID] Convert your images to base64 encoding. Useful for embedding images directly in HTML, CSS, or JSON files to reduce HTTP requests and improve page load times.

[ID] Output Options

[ID] Complete data URI format (data:image/type;base64,...)
[ID] Raw base64 string without the data URI prefix
[ID] CSS background-image property with data URI
[ID] HTML img tag with data URI as src

[ID] Maximum File Size

[ID] Maximum file size: 5MB. Larger files will be rejected.

0 KB / 5 MB

[ID] Supported Image Formats

  • JPG / JPEG
  • PNG
  • GIF
  • SVG
  • WEBP
  • BMP
  • ICO

[ID] Upload Image

[ID] Drag and drop an image here or [ID] browse

[ID] Maximum file size: 5MB

[ID] Base64 Result

[ID] What is Base64 Image Encoding?

Base64 encoding is a method of converting binary data (like images) into a text format using 64 ASCII characters. This makes it possible to embed image data directly into HTML, CSS, or JSON files. When an image is base64 encoded, it becomes a text string that can be included inline, eliminating the need for a separate HTTP request to fetch the image.

[ID] Benefits of Using Base64 Encoded Images

[ID] When to Use Base64 Encoded Images

While base64 encoding has benefits, it's not always the best choice. Here are some guidelines for when to use base64 encoded images:

[ID] Important Note

Base64 encoded images are approximately 33% larger in file size than their binary equivalents. For large images or images that appear multiple times on your website, traditional image files with proper caching are usually more efficient. Consider using base64 encoding only for small, infrequently changed images where reducing HTTP requests is more beneficial than the increased file size.

[ID] How to Use Base64 Encoded Images

Once you've converted your image to base64, you can use it in several ways:

[ID] In HTML

Description

[ID] In CSS

.element {
    background-image: url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAA...);
}

[ID] In Markdown

![Description](data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAA...)

[ID] Image Formats and Base64

All common image formats can be base64 encoded, but some are more efficient than others: