Convert XLSX to Base64

Drag and drop files here or click to select.
Max file size 100mb.
Uploading progress:

XLSX vs Base64 Format Comparison

Aspect XLSX (Source Format) Base64 (Target Format)
Format Overview
XLSX
Office Open XML Spreadsheet

XLSX is the default file format for Microsoft Excel since 2007. Based on the Office Open XML (OOXML) standard (ISO/IEC 29500), it stores spreadsheet data in a ZIP-compressed XML package. XLSX supports multiple worksheets, formulas, charts, pivot tables, conditional formatting, data validation, and rich cell formatting including fonts, colors, and borders.

Spreadsheet Office Open XML
Base64
Base64 Encoding Scheme

Base64 is a binary-to-text encoding scheme that represents binary data using 64 ASCII characters (A-Z, a-z, 0-9, +, /). It is widely used to encode binary files for transmission through text-based channels such as email (MIME), JSON APIs, XML documents, and data URIs in HTML/CSS.

Encoding Text Representation
Technical Specifications
Structure: ZIP container with XML content (Office Open XML)
Encoding: UTF-8 XML within ZIP archive
Standard: ISO/IEC 29500 (ECMA-376)
Max Rows: 1,048,576 rows x 16,384 columns per sheet
Extensions: .xlsx
Structure: ASCII text string using 64 characters
Standard: RFC 4648 (Base Encodings)
Character Set: A-Z, a-z, 0-9, +, / (= for padding)
Size Overhead: ~33% larger than original binary
Extensions: .b64, .base64, .txt
Syntax Examples

XLSX stores data in structured XML cells:

Sheet1:
  A1: Name    B1: Email
  A2: Alice   B2: [email protected]
  A3: Bob     B3: [email protected]

(Binary ZIP archive containing XML)

Base64 encodes the binary XLSX as ASCII text:

UEsDBBQAAAAIAGBkX1kAAA
ABAgMEBQYHCAkKCwwNDg8Q
ERITFBUWFxgZGhscHR4fIC
EiIyQlJicoKSorLC0uLzAx
MjM0NTY3ODk6Ozw9Pj9AQQ
==
Content Support
  • Multiple worksheets in one file
  • Cell formatting (fonts, colors, borders)
  • Formulas and calculated fields
  • Charts and graphs
  • Pivot tables and data analysis
  • Conditional formatting rules
  • Data validation and dropdown lists
  • Encodes any binary data as text
  • Preserves complete file integrity
  • Safe for text-based transport
  • Embeddable in JSON and XML
  • Compatible with email (MIME)
  • Data URI scheme support
  • No data loss during encoding
Advantages
  • Full spreadsheet functionality with formulas
  • Native data type support (numbers, dates)
  • Rich formatting and styling options
  • Multiple sheets in a single file
  • Industry standard for business data
  • Built-in data analysis tools
  • Text-safe representation of binary data
  • Universal support in all programming languages
  • Can embed files in JSON/XML payloads
  • Works with any text-based protocol
  • No data corruption during transfer
  • Simple encode/decode operations
Disadvantages
  • Larger file size than plain text formats
  • Binary format (not human-readable)
  • Requires specialized software to edit
  • Not ideal for version control
  • Complex internal XML structure
  • 33% size increase over original binary
  • Not human-readable content
  • No direct editing of encoded data
  • Must decode to access spreadsheet content
  • Performance overhead for very large files
Common Uses
  • Financial reports and accounting
  • Business data analysis
  • Project management and tracking
  • Inventory management
  • Data visualization with charts
  • Embedding files in API payloads
  • Email attachments (MIME encoding)
  • Data URIs in HTML and CSS
  • Storing binary data in databases
  • Transferring files via text protocols
Best For
  • Interactive data analysis and reporting
  • Business documents with formatting
  • Multi-sheet workbooks
  • Sharing data with non-technical users
  • Embedding XLSX in JSON API responses
  • Transferring files through text channels
  • Storing spreadsheets in text databases
  • Including files in XML configurations
Version History
Introduced: 2007 (Office 2007, replacing .xls)
Standard: ECMA-376 (2006), ISO/IEC 29500 (2008)
Status: Industry standard, active development
MIME Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Origin: 1987 (privacy-enhanced mail, PEM)
MIME Base64: RFC 2045 (1996)
Current Standard: RFC 4648 (2006)
Status: Universal standard, stable
Software Support
Microsoft Excel: Native format (full support)
Google Sheets: Full import/export support
LibreOffice Calc: Full support
Other: Python (openpyxl), Apache POI, SheetJS
Languages: All (Python, JS, Java, C#, Go, PHP, Ruby)
CLI Tools: base64 (Unix), certutil (Windows)
Web APIs: btoa()/atob() in browsers
Other: OpenSSL, curl, all HTTP libraries

Why Convert XLSX to Base64?

Converting XLSX to Base64 encoding is essential when you need to transmit Excel files through text-only channels. Many APIs, messaging systems, and configuration formats only support text data and cannot handle binary files directly. Base64 encoding transforms the binary XLSX file into a safe ASCII string that can be embedded in JSON payloads, XML documents, HTML data URIs, or email messages without data corruption.

A common use case is sending Excel reports via REST APIs. When building web applications that generate or accept spreadsheet files, the XLSX data often needs to travel as part of a JSON request or response body. Base64 encoding the XLSX file allows it to be included as a string value in JSON, preserving the complete file with all worksheets, formulas, formatting, and charts intact.

Base64 is also used extensively in email systems. The MIME standard uses Base64 encoding for binary email attachments. When programmatically constructing emails with XLSX attachments, you need the Base64-encoded representation of the file to create proper MIME multipart messages.

Key Benefits of Converting XLSX to Base64:

  • API Integration: Embed Excel files in JSON/XML API payloads
  • Data Integrity: Zero data loss during text-based transmission
  • Email Embedding: Create MIME-compliant email attachments
  • Database Storage: Store spreadsheet files in text-only database fields
  • Universal Decoding: Every programming language can decode Base64
  • Web Integration: Use data URIs to embed files in web pages

Practical Examples

Example 1: Embedding in JSON API

Input XLSX file (report.xlsx):

Excel Spreadsheet - Sheet1:
+----------+--------+--------+
| Quarter  | Sales  | Growth |
+----------+--------+--------+
| Q1 2025  | 150000 | 12%    |
| Q2 2025  | 175000 | 16.7%  |
+----------+--------+--------+

Output Base64 (for JSON embedding):

{
  "filename": "report.xlsx",
  "content_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
  "data": "UEsDBBQAAAAIAGN0cFkpF0T8nwEAADkE..."
}

Example 2: Email Attachment (MIME)

Input XLSX file (invoice.xlsx):

Excel Spreadsheet - Sheet1:
+----------+----------+--------+
| Item     | Quantity | Total  |
+----------+----------+--------+
| Service A| 10       | $500   |
| Service B| 5        | $250   |
+----------+----------+--------+

Output Base64 (MIME attachment):

Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="invoice.xlsx"

UEsDBBQAAAAIAGBkX1kAAACBAgME
BQYHCAkKCwwNDg8QERITFBUWFxgZ
GhscHR4fICEiIyQlJicoKSorLC0u
LzAxMjM0NTY3ODk6Ozw9Pj9AQQ==

Example 3: HTML Data URI

Input XLSX file (data.xlsx):

Excel Spreadsheet - Sheet1:
+------+-------+
| Name | Score |
+------+-------+
| Test | 95    |
+------+-------+

Output Base64 (data URI for download link):

<a href="data:application/vnd.openxmlformats-
officedocument.spreadsheetml.sheet;base64,
UEsDBBQAAAAIAGBkX1kAAAA..."
download="data.xlsx">Download Excel File</a>

Frequently Asked Questions (FAQ)

Q: What is Base64 encoding?

A: Base64 is a binary-to-text encoding scheme defined in RFC 4648 that represents binary data using a set of 64 printable ASCII characters. It converts every 3 bytes of binary data into 4 ASCII characters, making it safe for transmission through text-based systems. The resulting string contains only letters (A-Z, a-z), digits (0-9), plus (+), slash (/), and equals (=) for padding.

Q: How much larger is the Base64 output compared to the XLSX file?

A: Base64 encoding increases file size by approximately 33%. A 100 KB XLSX file will produce roughly 133 KB of Base64 text. This overhead is the trade-off for text-safe representation of binary data. For very large spreadsheets, consider whether the size increase is acceptable for your use case.

Q: Can I decode the Base64 string back to XLSX?

A: Yes, Base64 encoding is fully reversible with zero data loss. You can decode the Base64 string back to the original XLSX file using any programming language (Python's base64 module, JavaScript's atob(), Java's Base64 class) or command-line tools (base64 -d on Unix). The decoded file will be identical to the original.

Q: Is the Base64 output a single continuous string?

A: The output is a continuous Base64 string without line breaks by default. Some implementations add line breaks every 76 characters (as per MIME standard). Both formats are valid and can be decoded correctly. You can choose the format that best suits your integration needs.

Q: Can I embed the Base64 string directly in HTML?

A: Yes, you can create a download link using a data URI: <a href="data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,YOUR_BASE64_STRING" download="file.xlsx">Download</a>. However, this approach has browser-specific size limits (typically 2-10 MB for data URIs).

Q: Is the Base64 encoding secure?

A: Base64 is an encoding scheme, not encryption. The data is easily decodable by anyone. If your spreadsheet contains sensitive information, you should encrypt the data before Base64 encoding, or use secure transport protocols (HTTPS, TLS) when transmitting the encoded data.

Q: How do I use the Base64 string in a REST API?

A: Include the Base64 string as a field value in your JSON request body, for example: {"file": "UEsDBBQ...", "filename": "data.xlsx"}. The receiving server decodes the Base64 string and saves it as an XLSX file. This pattern is commonly used in APIs that accept file uploads via JSON.

Q: Are all Excel features preserved in the Base64 encoding?

A: Yes, Base64 encodes the complete binary XLSX file, preserving every byte including all worksheets, formulas, charts, formatting, pivot tables, and embedded objects. When decoded, the XLSX file is byte-for-byte identical to the original.