User Agents

Web browsers and everyday web tech, explained

Tab Delimited Files: How to Create Them Easily

· 5 min read · Browsers

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Creating a tab delimited file allows you to organize data into a structured table format where a tab character separates each piece of information (field) instead of a comma or semicolon. This format, often saved as a .txt or .tsv (Tab-Separated Values) file, is highly valued in data science and database management because it avoids the common conflict where commas within the actual data (such as in addresses or company names) break the structure of a standard CSV file.

What You'll Need

  • A computer with a text editor (Notepad, TextEdit, VS Code) or a spreadsheet application (Microsoft Excel, Google Sheets, LibreOffice Calc).
  • The data you wish to organize.
  • Basic knowledge of how to save files with specific extensions.

Step-by-Step

Method 1: Using Spreadsheet Software (Excel, Google Sheets)

This is the most efficient method for large datasets as the software handles the alignment and tab insertion automatically.

  1. Enter Your Data: Open your spreadsheet program and enter your data into cells. Each column represents a field, and each row represents a record. Ensure your first row contains headers (e.g., Name, Email, Phone) for better organization.
  2. Review the Layout: Check for any merged cells or complex formatting. Tab delimited files are plain text; any bolding, colors, or merged cells will be stripped away during the export process.
  3. Save As / Export:
    • In Microsoft Excel: Go to File > Save As. In the file type dropdown menu, select Text (Tab delimited) (*.txt).
    • In Google Sheets: Go to File > Download > Tab-separated values (.tsv).
  4. Confirm File Location: Choose the folder where you want to save the file and click Save or Download.
  5. Verify the Output: Open the resulting .txt or .tsv file in a basic text editor to ensure the data is separated by tabs and not commas.

Method 2: Using a Plain Text Editor (Notepad, TextEdit)

This method is best for very small files or when you need to manually edit a single record without launching a heavy spreadsheet application.

  1. Open the Editor: Launch your preferred text editor (e.g., Notepad on Windows or TextEdit on macOS).
  2. Set to Plain Text: If using TextEdit on Mac, ensure you go to Format > Make Plain Text. Rich text (.rtf) files will not work as tab delimited files.
  3. Type Your Headers: Type the name of your first column, press the Tab key on your keyboard once, type the second column name, and so on. Press Enter to start a new line.
  4. Enter the Data: For every row of data, follow the same pattern: Data Point > Tab > Data Point > Tab > Enter. Do not use the spacebar to align columns; you must use the Tab key.
  5. Save the File: Go to File > Save As. Name your file and ensure the extension is either .txt or .tsv.

Common Mistakes

  • Using Spaces Instead of Tabs: The most frequent error is trying to visually align columns using the spacebar. Software reading tab delimited files looks specifically for the tab character (\t); spaces are treated as part of the data itself, which will shift your columns.
  • Including Commas in Data: While tab delimited files are designed to handle commas within a cell, some users mistakenly save the file as a CSV (Comma Separated Values) while thinking it is tab delimited. Always check the file extension.
  • Adding Extra Tabs: Pressing the Tab key twice between columns creates an "empty" column in the eyes of the importing software, which will misalign your entire dataset.
  • Saving as Rich Text: Saving a file as .rtf or .doc adds hidden formatting code to the file. Tab delimited files must be saved as Plain Text.

Tips

  • Use .tsv Extensions: While .txt is universal, using .tsv (Tab-Separated Values) explicitly tells other users and software exactly what the delimiter is.
  • Header Consistency: Always include a header row. This makes it significantly easier to map the data when importing the file into a database or another software tool.
  • Clean Your Data First: Before exporting from a spreadsheet, use the "Find and Replace" tool to remove any actual tab characters that might exist within your text strings, as these will be interpreted as column breaks.
  • Use a Code Editor for Large Files: If you are editing a very large tab delimited file, use an editor like VS Code or Sublime Text. These tools often have "invisible character" toggles that allow you to see exactly where the tabs are located.

Troubleshooting

The data looks like one long string when I open it.
This usually happens when you open a .txt file in a program that doesn't recognize tabs as spacing. Try opening the file in a spreadsheet program (Import > Text File) to see if the columns align correctly.

The columns are shifted or misaligned.
This is almost always caused by an "extra" tab character hidden inside one of the data cells. Search your source data for any accidental tab presses and delete them.

The software I'm importing into says "Invalid Format".
Check the file encoding. Most modern systems expect UTF-8 encoding. When saving from a text editor, look for the Encoding dropdown menu next to the Save button and ensure UTF-8 is selected.

Frequently Asked Questions

What is the difference between a CSV and a TSV?

A CSV uses commas to separate data, while a TSV (Tab-Separated Values) uses tabs. TSVs are generally safer for data that contains naturally occurring commas, such as street addresses.

Can I convert a CSV to a tab delimited file?

Yes. The easiest way is to open the CSV in Excel or Google Sheets and then use the "Save As" or "Download" function to export it as a Tab-separated values (.tsv) or Text (Tab delimited) file.

Do tab delimited files work on both Mac and Windows?

Yes, tab delimited plain text files are cross-platform and can be opened by any basic text editor or spreadsheet software on any operating system.

Why would I use a tab delimited file instead of an Excel workbook (.xlsx)?

Tab delimited files are plain text, making them lightweight and compatible with almost every piece of software ever written, including legacy systems and programming languages, whereas .xlsx is a proprietary binary format.

Does the number of tabs have to be the same in every row?

Yes. For the file to be valid, every row must have the same number of delimiters. If one row has four tabs and the next has three, the importing software will likely throw an error or shift the data incorrectly.