Convert TSV to Base64
Max file size 100mb.
TSV vs Base64 Format Comparison
| Aspect | TSV (Source Format) | Base64 (Target Format) |
|---|---|---|
| Format Overview |
TSV
Tab-Separated Values
Plain text format using tab characters as column delimiters. TSV is the native clipboard format when copying data from Excel or Google Sheets. Widely used in bioinformatics and scientific computing because tab delimiters eliminate the quoting ambiguity that plagues CSV files. Tabular Data Clipboard Native |
Base64
Base64 Encoding
A binary-to-text encoding scheme that represents binary or text data using 64 ASCII characters (A-Z, a-z, 0-9, +, /). Base64 is used to safely embed data in text-only contexts such as JSON payloads, email attachments (MIME), XML documents, data URIs, and HTTP headers. Encoding Transport Safe |
| Technical Specifications |
Structure: Rows and columns in plain text
Delimiter: Tab character (U+0009) Encoding: UTF-8 or ASCII Headers: Optional first row as column names MIME Type: text/tab-separated-values Extensions: .tsv, .tab |
Structure: Continuous string of ASCII characters
Character Set: A-Z, a-z, 0-9, +, / (and = padding) Size Increase: ~33% larger than original Standard: RFC 4648 Extensions: .b64, .base64 |
| Syntax Examples |
TSV uses tab characters between values (shown as spaces): Name Email Role Alice [email protected] Admin Bob [email protected] User |
Base64 produces a single encoded string: TmFtZQlFbWFpbAlSb2xlCk FsaWNlCWFsaWNlQGV4YW1w bGUuY29tCUFkbWluCkJvYg lib2JAZXhhbXBsZS5jb20J VXNlcg== |
| Content Support |
|
|
| Advantages |
|
|
| Disadvantages |
|
|
| Common Uses |
|
|
| Best For |
|
|
| Version History |
Introduced: 1960s (mainframe era)
IANA Registration: text/tab-separated-values Status: Widely used, stable MIME Type: text/tab-separated-values |
Introduced: 1987 (RFC 989 for PEM)
Current Standard: RFC 4648 (2006) Status: Universal standard Variants: Standard, URL-safe, MIME |
| Software Support |
Microsoft Excel: Full support (open/save)
Google Sheets: Full support (import/export) LibreOffice Calc: Full support Other: Python, R, pandas, Unix tools |
Every Language: Built-in base64 support
Browsers: btoa()/atob() in JavaScript Command Line: base64 command (Linux/Mac) Other: Python, Java, C#, Go, Rust, PHP |
Why Convert TSV to Base64?
Converting TSV data to Base64 encoding makes your tab-delimited data safe for transmission through text-only channels. TSV files contain tab characters and newlines that can be corrupted or misinterpreted when embedded in JSON payloads, XML documents, email bodies, or HTTP headers. Base64 encoding transforms the entire TSV content into a safe string of printable ASCII characters that can travel through any text channel without alteration.
This conversion is essential for web developers and API designers who need to include TSV data in API requests or responses. When building a REST API that accepts or returns tabular data, Base64-encoding the TSV content allows it to be safely embedded in a JSON string field. The receiving application decodes the Base64 string to recover the exact original TSV data, including all tab characters and line breaks.
Base64-encoded TSV is also valuable for email systems. When attaching TSV data to automated emails or embedding it in email templates, Base64 encoding ensures that email servers and clients do not alter the tab characters or line endings. This is the same MIME encoding mechanism used for email attachments, making it a proven approach for reliable data delivery.
For data URI applications, converting TSV to Base64 allows you to embed tabular data directly in HTML or CSS without a separate file. This is useful for self-contained HTML reports, single-page applications, and offline-capable web tools that need to include data tables without server requests. The encoded TSV can be decoded by JavaScript in the browser.
Key Benefits of Converting TSV to Base64:
- Transport Safety: Tab characters and newlines are safely preserved in the encoding
- API Ready: Embed TSV data in JSON, XML, or HTTP payloads without escaping issues
- Email Compatible: Standard MIME encoding for reliable email delivery
- Data URI Support: Embed TSV data directly in HTML/CSS documents
- Universal Decoding: Every programming language has built-in Base64 decode support
- Lossless: Decoding reproduces the exact original TSV file byte-for-byte
- Cross-Platform: Base64 strings work identically across all operating systems
Practical Examples
Example 1: API Payload with Embedded TSV
Input TSV file (users.tsv):
Username Email Role admin [email protected] Administrator jdoe [email protected] Editor msmith [email protected] Viewer
Note: Columns are separated by tab characters in the actual file.
Output Base64 encoded string:
VXNlcm5hbWUJRW1haWwJUm9sZQphZG1pbglhZG1pbkBleGFt cGxlLmNvbQlBZG1pbmlzdHJhdG9yCmpkb2UJamRvZUBleGFt cGxlLmNvbQlFZGl0b3IKbXNtaXRoCW1zbWl0aEBleGFtcGxl LmNvbQlWaWV3ZXI=
Example 2: Data URI for HTML Embedding
Input TSV file (config.tsv):
Setting Value Description timeout 30 Request timeout in seconds retries 3 Maximum retry attempts debug false Enable debug logging
Note: Columns are separated by tab characters in the actual file.
Output Base64 for use in a data URI:
data:text/tab-separated-values;base64,U2V0dGluZwlWYWx1 ZQlEZXNjcmlwdGlvbgp0aW1lb3V0CTMwCVJlcXVlc3QgdGlt ZW91dCBpbiBzZWNvbmRzCnJldHJpZXMJMwlNYXhpbXVtIHJl dHJ5IGF0dGVtcHRzCmRlYnVnCWZhbHNlCUVuYWJsZSBkZWJ1 ZyBsb2dnaW5n
Example 3: Email Attachment Encoding
Input TSV file (report.tsv):
Month Revenue Expenses Profit January 50000 35000 15000 February 55000 37000 18000 March 48000 33000 15000
Note: Columns are separated by tab characters in the actual file.
Output Base64 for MIME email attachment:
Content-Type: text/tab-separated-values; name="report.tsv" Content-Transfer-Encoding: base64 TW9udGgJUmV2ZW51ZQlFeHBlbnNlcwlQcm9maXQKSmFudWFy eQk1MDAwMAkzNTAwMAkxNTAwMApGZWJydWFyeQk1NTAwMAkz NzAwMAkxODAwMApNYXJjaAk0ODAwMAkzMzAwMAkxNTAwMA==
Frequently Asked Questions (FAQ)
Q: What is Base64 encoding?
A: Base64 is a binary-to-text encoding scheme defined in RFC 4648. It converts any data (binary or text) into a string using only 64 safe ASCII characters: uppercase A-Z, lowercase a-z, digits 0-9, plus (+), and slash (/), with equals (=) for padding. This encoding ensures data can be safely transmitted through systems that only handle text, such as email, JSON, and XML.
Q: Why would I Base64-encode a TSV file?
A: TSV files contain tab characters (U+0009) and newlines that can be corrupted or misinterpreted when transmitted through text-based protocols. Base64 encoding converts the entire TSV content into printable ASCII characters, making it safe to embed in JSON strings, XML elements, email bodies, URL parameters, and HTTP headers without data loss or corruption.
Q: How much larger is the Base64-encoded output?
A: Base64 encoding increases the data size by approximately 33%. Every 3 bytes of input become 4 Base64 characters. For example, a 1 KB TSV file would produce approximately 1.37 KB of Base64 output. This overhead is the trade-off for transport safety and is acceptable for most use cases involving API payloads and email attachments.
Q: Can I decode the Base64 back to the original TSV?
A: Yes, Base64 encoding is fully reversible. Decoding the Base64 string produces the exact original TSV file byte-for-byte, including all tab characters and line endings. Every programming language includes built-in Base64 decode functions (e.g., Python's base64.b64decode, JavaScript's atob, Java's Base64.getDecoder). The command line tool base64 -d also works on Linux and Mac.
Q: Is Base64 the same as encryption?
A: No. Base64 is an encoding, not encryption. It does not provide any security or confidentiality. Anyone can decode a Base64 string using freely available tools. Its purpose is to make binary or special-character data safe for text-based transport channels. If you need to protect your TSV data, apply encryption before Base64 encoding.
Q: What is a data URI and how does Base64 help?
A: A data URI is a way to embed file contents directly in HTML or CSS using the format data:[mime-type];base64,[encoded-data]. For TSV files, this would be data:text/tab-separated-values;base64,[your-encoded-tsv]. This allows you to include TSV data directly in an HTML page without requiring a separate file or server request, which is useful for self-contained reports and offline web applications.
Q: Does the encoding preserve the tab delimiter structure?
A: Yes. Base64 encoding preserves every byte of the original file, including tab characters, newlines, and any Unicode content. When the Base64 string is decoded, the result is identical to the original TSV file. The tab-separated column structure is fully intact and ready for parsing by any TSV reader.
Q: Are there different variants of Base64?
A: Yes. The standard Base64 alphabet uses A-Z, a-z, 0-9, +, and /. The URL-safe variant (Base64URL) replaces + with - and / with _, making it safe for URLs and filenames. Our converter uses standard Base64 (RFC 4648), which is the most widely used variant for API payloads and email encoding. If you need URL-safe encoding, the output can be easily converted by replacing the two characters.