Entrada

Haz clic o arrastra y suelta cualquier archivo

PDF, imágenes, audio, video, documentos (Máx 10MB)

Salida

File to Base64 Examples

Upload any file to get its Base64 or Data URI output. Example of a Data URI for a 1×1 PNG:

Sample Data URI output

Data URI format

Upload a file above to generate your own Base64 output.

What Is File to Base64?

File to Base64 converts any binary file into a Base64-encoded ASCII string. Unlike the Image to Base64 tool which is limited to image types, this tool accepts any file type: PDFs, audio files, video clips, Word documents, ZIP archives, fonts, and more. Base64 is defined by RFC 4648 and encodes binary data as printable ASCII text.

The output can be a full Data URI (e.g., data:application/pdf;base64,...) or just the raw Base64 string. Data URIs embed files directly in HTML, CSS, or JSON without needing separate file hosting. Processing runs entirely in your browser—no data is sent to any server. To convert Base64 back to a downloadable file, use Base64 to File.

How to Use This Tool

1

Upload Your File

Click the upload area, drag and drop a file, or use the Upload button. Any file type is accepted up to 10 MB. The left panel shows the file name, size, and detected MIME type.

2

Choose Output Format

Toggle Include data: prefix to switch between a full Data URI (ready for HTML/CSS embedding) and a raw Base64 string (for APIs or storage). The right panel updates immediately.

3

Copy or Download

Click Copy to put the output on your clipboard, or Download to save it as a .txt file. To decode Base64 back to the original file, use Base64 to File.

Data URI vs Raw Base64

A Data URI includes the MIME type and encoding scheme as a prefix:

Data URI format

Use Data URIs when embedding files in HTML, CSS, or JSON (e.g., <img src="data:image/png;base64,..."> or background-image: url(data:image/svg+xml;base64,...)). Use raw Base64 when sending to APIs that specify the MIME type separately, or when storing in a database field. The toggle on this tool lets you switch between both formats instantly.

Frequently Asked Questions

Is my data private?

Yes. Conversion runs entirely in your browser using the FileReader.readAsDataURL() API. No data is sent to any server. You can verify this by checking your browser's Network tab.

What file types are supported?

All file types are supported: images (JPG, PNG, SVG, WebP), documents (PDF, DOCX), audio (MP3, WAV), video (MP4, WebM), fonts (TTF, WOFF), archives (ZIP), and any other binary format. The MIME type is detected automatically from the file.

What is the size limit?

The tool limits uploads to 10 MB. Base64 encoding adds ~33% overhead, so a 10 MB file produces ~13.3 MB of text. Very large files may slow down the browser. For huge files, consider command-line tools like GNU base64.

Can I embed a PDF in HTML?

Yes. Upload your PDF, enable the Data URI toggle, and use the output as: <embed src="data:application/pdf;base64,..." type="application/pdf">. Browser support for embedded PDFs varies. For large PDFs, an external URL is usually better for performance.

How do I convert Base64 back to a file?

Use the Base64 to File tool. Paste your Base64 string, specify the filename and MIME type, and download the reconstructed file.

Related Tools

For the Base64 specification, see RFC 4648. MDN's Data URIs guide covers embedding. FileReader API handles file reading in the browser.

Incrustar imagenes en CSS, empaquetar iconos como Data URIs, o meter un PDF pequeno en una config JSON — los desarrolladores se encuentran con este flujo mas a menudo de lo que crees. Esta herramienta convierte cualquier archivo a Base64 directamente en tu navegador. Solo arrastra y suelta — tu archivo nunca sale de tu maquina.

Cómo usar el Convertidor de Archivo a Base64

1

Sube o arrastra tu archivo

Haz clic en el área de carga o arrastra y suelta cualquier archivo — imágenes, PDFs, documentos, audio — en el convertidor. La herramienta funciona con cualquier tipo de archivo.

2

Obtén el string Base64

El archivo se convierte instantáneamente en un string codificado en Base64. La salida completa aparece en el cuadro de salida lista para usar.

3

Copia el string codificado

Haz clic en Copiar para obtener el string Base64. Úsalo en HTML (data URIs), CSS, payloads JSON, o donde necesites incrustar datos binarios como texto.

Ejemplo de salida

Ejemplo: Icono PNG pequeño convertido a Base64

Archivo:

icon.png (PNG transparente de 1x1 píxel, 68 bytes)

Salida Base64 (formato data URI):

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==

Frequently Asked Questions

Que tipos de archivos puedo convertir a Base64?

Cualquier archivo que tu navegador pueda leer — imagenes, PDFs, audio, video, documentos y mas. El unico limite es 10MB.

Se sube mi archivo a un servidor?

No. La conversion ocurre localmente via la FileReader API. Tu archivo nunca sale de tu maquina.

Cual es la diferencia entre Base64 y Data URI?

Base64 es la codificacion en si (RFC 4648). Un Data URI envuelve el string Base64 con un prefijo MIME como data:image/png;base64,.

Base64 aumenta el tamano del archivo?

Si — la codificacion Base64 aumenta el tamano de los datos en aproximadamente un 33%. Por eso es mejor para archivos pequenos.

Related Tools