Conversor de SVG a Base64 gratuito
El Conversor de SVG a Base64 codifica el marcado SVG en un data URI que puedes incrustar en CSS, HTML o una etiqueta img. Elige entre salida Base64 y URL-encoded.
The raster equivalent is the Image to Base64 Converter, and the asset itself can be reduced first with the SVG Optimizer. To rasterise it instead of encoding it, the SVG to PNG Converter is the tool.
Cómo usar SVG a Base64
- 1 Paste the SVG markup, or drop an `.svg` file. The source must be valid XML.
- 2 Choose whether to output a data URI for CSS, a bare Base64 payload, or an `<img>` tag.
- 3 Minify first if you are inlining into CSS — stripping whitespace and metadata often cuts the file by half before encoding even begins.
- 4 Copy the result. For CSS, wrap it as `url("data:image/svg+xml;base64,…")`.
Cómo usarlo
Pega tu código SVG y elige un formato de salida. El data URI codificado aparece al instante: cópialo para usarlo en tus hojas de estilo o marcado.
- Formatos Base64 y URL-encoded
- Vista previa en vivo del SVG renderizado
- Copiar con un clic
Preguntas frecuentes
Should I use Base64 or URL-encoding for an inline SVG?
URL-encoding usually wins for SVG. Base64 adds 33% overhead on top of markup that is already text, and it makes the value impossible to read or edit in place. Percent-encoding keeps the markup visible, compresses better under gzip, and only requires escaping a handful of characters such as `#`, `<`, `>` and quotes. Reach for Base64 only when the surrounding context cannot carry the special characters.
Why can I not change the colour of an inlined SVG with CSS?
Because an inline data URI is treated as an embedded document, not as DOM you can style. `currentColor` and your stylesheet rules cannot reach inside it. To inherit the text colour, the SVG needs to be inlined as actual markup in the HTML, or the colours need to be baked into the file.
Does inlining an SVG help page speed?
Only for small, frequently-used icons, and only because it removes a round trip. A sprite of every icon in a set is usually the better trade: one small file, correctly cached, instead of adding the same weight to every stylesheet that uses it.
Herramientas de imagen y color relacionadas
También te puede interesar
Herramientas de otras categorías que suelen combinarse con SVG a Base64: