- Upload your image by clicking or dragging the file.
- The image is automatically converted to Base64.
- Choose your preferred output format (Data URI, Base64, HTML, or CSS).
- Copy the generated code to use in your project.
What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that represents binary data as ASCII text. It's commonly used to embed images directly in HTML, CSS, or JSON without needing separate image files.
When should I use Base64 images?
Base64 is ideal for small images like icons and logos (under 10KB). For larger images, traditional image files are more efficient as Base64 increases file size by about 33%.
What's the difference between Data URI and raw Base64?
Data URI includes the MIME type prefix (e.g., 'data:image/png;base64,') and can be used directly in HTML src attributes. Raw Base64 is just the encoded string without the prefix.
Base64 Encoding: RFC 4648, the BaseN Family, and Constant-Time Decoding
A rigorous treatment of Base64 from first principles: the mathematical basis for the 64-character alphabet (2⁶ = largest power-of-two mapping to printable ASCII), RFC 4648 canonical specification, the BaseN encoding family (Base16 through Base85 with size/alphabet trade-offs), streaming encoder and decoder state machines, MIME line-wrapping rules, PEM format anatomy, constant-time decoding for cryptographic contexts, SIMD-accelerated lookup tables, and production boundary advice for JWTs, data URLs, and HTTP Basic Auth.
Data URLs: Syntax, Security, Caching & Performance
Use Data URLs deliberately. This guide covers RFC 2397 syntax, percent and Base64 encoding, MIME and charset handling, opaque origins, CSP and navigation risks, cache trade-offs, size measurement, Blob URLs, and safe browser/server examples.
Base64
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format by translating it into a radix-64 representation. It uses 64 printable characters (A-Z, a-z, 0-9, +, /) to encode binary data.
Text-to-Image
Text-to-Image is a generative AI task that maps a natural-language prompt, and sometimes additional controls, to one or more synthetic images sampled from a learned visual distribution.
Text-to-Video
Text-to-Video is a generative AI task that maps a natural-language prompt, and sometimes additional controls, to a synthetic sequence of frames whose visual content and change over time are jointly generated.