Loading tool...
Convert images between PNG, JPG, WebP, AVIF, BMP formats. Features quality control, transparency support, and batch conversion for efficient workflow.
Resize and scale images with smart aspect ratio control. Supports custom dimensions, percentage scaling, social media presets, and batch resizing while maintaining image quality.
Crop and trim images with precision visual selection. Features aspect ratio presets (1:1, 16:9, 4:3), free-form cropping, grid overlays, and pixel-perfect adjustments for professional results.
Convert images to Base64 encoded strings with our free Image to Base64 converter, enabling you to embed images directly in web pages, CSS, emails, and code without separate file requests. Base64 encoding transforms binary image data into ASCII text that can be embedded as data URIs in HTML, CSS, or JavaScript, reducing HTTP requests and potentially improving performance for small images. The tool supports multiple output formats for different use cases - data URL format for direct use in img src attributes, raw Base64 for integration into code, CSS background syntax for background-image properties, HTML img tag for copy-paste convenience, and Markdown format for documentation. Base64 embedding is particularly useful for small images like icons, logos, single-pixel spacers, and decorative elements where the reduction in HTTP requests outweighs the slight file size increase from Base64 encoding (approximately 33% overhead). Modern web development often uses Base64 embedding for critical above-the-fold resources to improve initial page load performance. The tool processes images entirely in your browser, supporting all common formats (PNG, JPG, WebP, GIF, SVG) and generating properly formatted output ready to paste directly into your code.
Convert images to Base64 for use as background-image values in CSS, reducing file requests and enabling complete CSS-based styling.
Embed Base64 images directly in HTML emails ensuring images display even when external image hosting is blocked.
Reduce total HTTP requests by embedding critical small images as Base64 data URIs improving page load performance.
Generate data URI strings for embedding in JavaScript, HTML, or CSS for dynamic image manipulation.
Embed small icon and image assets directly in JavaScript bundles for single-page applications improving load performance.
Embed encoded images in markdown documents and technical documentation for self-contained files.
Base64 encoding is a binary-to-text encoding scheme that represents binary data using a set of 64 printable ASCII characters, enabling binary content like images to be safely transmitted through text-based protocols and embedded directly in text documents like HTML and CSS.
The Base64 algorithm works by processing binary data in groups of 3 bytes (24 bits) at a time. Each 24-bit group is divided into four 6-bit segments, and each 6-bit value (ranging from 0 to 63) is mapped to one character from the Base64 alphabet: A-Z (values 0-25), a-z (values 26-51), 0-9 (values 52-61), and + and / (values 62 and 63). When the input length is not a multiple of 3 bytes, padding is applied. If one byte remains, it produces two Base64 characters plus two = padding characters. If two bytes remain, it produces three Base64 characters plus one = padding character. This padding ensures that Base64 output length is always a multiple of 4 characters, making it parseable without knowing the original data length. The mathematical consequence is that Base64 encoding increases data size by exactly 4/3 (approximately 33%), since 3 bytes of input become 4 bytes of Base64 text.
Data URIs combine Base64-encoded content with a header that specifies the content type, following the format: data:[mediatype][;base64],[data]. For example, a PNG image becomes data:image/png;base64, followed by the Base64 string. When a browser encounters a data URI in an img src attribute or CSS background-image, it decodes the Base64 string back to binary and renders the image, completely eliminating the need for a separate HTTP request to fetch the image file.
The decision of when to use Base64 embedding versus external file linking involves a performance tradeoff analysis. Each external image file requires a separate HTTP request, which carries overhead: DNS lookup, TCP connection, TLS handshake (for HTTPS), HTTP headers, and server processing time. For HTTP/1.1, browsers limit concurrent connections per domain (typically 6-8), so many small images create a bottleneck. Base64 embedding eliminates these per-file requests but increases the HTML or CSS file size by 33% for each embedded image, and the Base64 data cannot be cached independently from the containing document. The general guidance is to embed images smaller than approximately 2-4 KB, where the HTTP request overhead exceeds the Base64 size penalty, and use external files for larger images where caching benefits outweigh request overhead. With HTTP/2 and HTTP/3 multiplexing, the per-request overhead is significantly reduced, shifting the tradeoff further toward external files for all but the smallest images.
All processing happens directly in your browser. Your files never leave your device and are never uploaded to any server.