Conversor de imagem para Base64 (data URI)
Codifique uma imagem como data URI em Base64, Base64 puro, background CSS ou tag img HTML para e-mails, CSS e código. Até 10 MB.
Entrada
Dica: pressione Ctrl + Enter para executar
Configurações salvas
Por enquanto, a ajuda detalhada abaixo está disponível apenas em inglês.
Sobre esta ferramenta
Base64 turns binary data such as an image into plain text, so it can be embedded directly in HTML, CSS, JSON or an email template without a separate file. A data URI (data:image/png;base64,…) can be used anywhere a URL is expected.
This tool reads an image from your device and gives you a data URI, raw Base64, a ready-made CSS background-image rule or an HTML img tag. Base64 makes data about a third larger, so it is best for small icons and images rather than large photos.
Como usar
- Choose an image up to 10 MB.
- Choose the output: data URI, raw Base64, CSS or HTML.
- Run it and copy the result into your code.
Como o cálculo funciona
The file is read with the FileReader API and encoded in Base64 (every 3 bytes become 4 text characters). The MIME type is taken from the file and used in the data URI prefix.
data:<mime>;base64,<bytes encoded in Base64> (≈ 4/3 × file size)Exemplo prático
A developer embeds a 1.2 KB SVG arrow icon into a CSS file to avoid an extra request. The CSS output gives background-image: url("data:image/svg+xml;base64,…") of about 1.6 KB: roughly a third larger than the file, but one fewer download for the page.
Exemplo de entrada e resultado
Escolha um arquivo e clique em Executar. O arquivo convertido é baixado direto pelo seu navegador.
Limitações
- Images up to 10 MB.
- Large data URIs make HTML and CSS slower to parse and cannot be cached separately.
- No decoding of Base64 back to an image in this tool.
Última atualização:
Perguntas frequentes
Why is the Base64 bigger than the image?
Base64 encodes 3 bytes as 4 characters, adding about 33% plus a little overhead.
Do email clients show data URIs?
Support is inconsistent; many clients block them. Attached or hosted images are more reliable.
Is my image uploaded?
No. Encoding happens in your browser.
Solução de problemas
The browser freezes on paste.
The string is very long; use a smaller image.
The image does not show in CSS.
Make sure the whole string, including the data: prefix, is inside url("...").
I need to decode Base64.
Use the Base64 encoder/decoder for text.
Privacidade & Uso gratuito
Meus dados são armazenados?
Seus dados ficam nesta aba. Não recebemos seus arquivos, textos colados nem valores de cálculo.
Esta ferramenta é gratuita?
Sim. Não é preciso cadastro nem pagamento.
Veja também
Próximos passos úteis
Conversor de JPG para PNG
Converta imagens JPG para PNG no seu navegador, até 30 de cada vez. O PNG mantém cada pixel e suporta transparência, ideal para capturas de tela, logotipos e gráficos.
Conversores de arquivosConversor de PNG para JPG
Converta imagens PNG para JPG no seu navegador, até 30 de cada vez. Arquivos JPG são leves e abrem em qualquer lugar, ideais para fotos e envio em formulários; áreas transparentes ficam brancas.
Conversores de arquivosConversor de WebP para JPG
Converta imagens WebP para JPG no seu navegador, até 30 de cada vez. Arquivos JPG são leves e abrem em qualquer lugar, ideais para fotos e envio em formulários; áreas transparentes ficam brancas.
Conversores de arquivos