๐ฅ File Operations ยท 8 min read
Why Is My CSV a Text File?
Because a CSV is a text file. That is the format, not a fault: RFC 4180 registers it as text/csv, a subtype of text, with one record per line and commas between fields. There is no header block, no column types and no formatting inside the file. So when people say a CSV "shows up as a text file", they usually mean one of three different things, and only two of them are problems: the name carries a second extension like .csv.txt, the computer has handed the file to a text editor, or the file is not CSV at all despite the name.
The rest of this page is a way to tell those three apart in about two minutes, because the fix is different for each and only one of them involves editing the data.
What "text file" actually means for a CSV
RFC 4180 is the closest thing the format has to a specification, and section 3 registers it with a media type name of text and a subtype of csv. The same section notes that common usage is US-ASCII, with other character sets allowed through the optional charset parameter.
Section 2 goes further and defines the whole file in seven rules: each record on its own line, separated by CRLF; an optional header line with the same format; the same number of fields on every line; fields containing commas, quotes or line breaks wrapped in double quotes; and a quote inside a quoted field written as two quotes. Every one of those rules is about characters. Nothing in the file says which column is a number or a date. That interpretation happens in whatever app opens the file, which is why the same CSV can show as 001 in one program and 1 in another.
So a text editor is not the wrong tool to look at a CSV. It is the right tool to look at the bytes and the wrong tool to see a table. The guide to the CSV file format walks through the rules in order if you want the full grammar.
Windows decides by extension, not by content
Microsoft's own description of file name extensions is blunt about it: a Windows file name has two parts separated by a period, the name and "a three- or four-character extension that defines the file type", and "extensions tell your computer which application created or can open the file and which icon to use for the file".
That is a lookup table, not an inspection. We confirmed it by taking a saved HTML login page and giving it the name login.csv: 33 bytes starting with 3C 21 44 4F, which is the text <!DOCTYPE. Ask any extension-based mapping what type that file is and the answer is text/csv, because it ends in .csv. The label is trusted; the contents are not read.
This cuts both ways, and the second direction is where most people lose time: a genuine CSV named export.txt is reported as text/plain everywhere, including to the website or CRM that then rejects it as the wrong type.
Three complaints that sound the same
| What you see | What is actually wrong | The fix |
|---|---|---|
The file is named data.csv.txt | A second extension was appended by a download, a text editor or an export tool | Verify the contents, then rename to a single .csv |
| The file opens in Notepad and shows commas | .csv is associated with a text editor, and extensions may be hidden so the name looks fine | Open with Excel or Numbers, or turn on file name extensions and check the name |
| The site says it is not a valid CSV, or the import is empty | The bytes are not CSV: an HTML error page, a renamed .xlsx, or a tab-separated file | Re-export from the source, or convert the delimiter properly |
Note what is missing from that table: "the file is text". That is the one thing you can rule out immediately.
Two minutes of diagnosis
Step one: turn extensions on. In File Explorer, Microsoft documents the path as View > Show > File name extensions. Without it, a file called data.csv.txt displays as data.csv and the whole mystery is invisible.
Step two: read the first bytes. This is the fastest way to know whether the contents match the name, and you do not need a special tool: open the file in a text editor and look at the first line, or on Windows run certutil -dump data.csv to see the hex.
69 64 2c 6e 61 6d 65isid,name. That is a CSV.EF BB BFat the very start is a UTF-8 byte order mark. Still a CSV, but some parsers keep it as an invisible character glued to the first column name, which the guide to CSV encoding covers.3C 21 44 4Fis<!DO, the start of a doctype. You have an HTML page, most likely a login screen or an error page that was saved instead of the export.50 4B 03 04is the ZIP signature. An .xlsx file renamed to .csv starts this way, because the format is a zipped package.
Step three: count the line endings. RFC 4180 section 2 asks for CRLF. A file written with bare line feeds still parses in most libraries, but is exactly what makes an older Excel show every record on one line, which looks like a one-column file and sends people looking for a delimiter bug that is not there.
What we measured
Four files, built by hand on 2026-10-30, each ending in .csv except where noted. The type column is what the extension maps to, not what the bytes are:
| File | Bytes | First bytes | Type from extension | CRLF count |
|---|---|---|---|---|
names.csv | 45 | 69 64 2c 6e 61 6d 65 2c | text/csv | 3 |
names.csv.txt | 16 | 69 64 2c 6e 61 6d 65 0d | text/plain | 2 |
login.csv | 33 | 3c 21 44 4f 43 54 59 50 | text/csv | 0 |
names-bom.csv | 48 | ef bb bf 69 64 2c | text/csv | 3 |
Row three is the point of the exercise: identical extension, completely different content, and the type reported is still text/csv. Row two shows the reverse: a real CSV that every extension-based lookup calls text/plain.
Fixing it without breaking the data
If the extension is the problem, rename it, but only after step two above confirms the contents. Renaming an HTML page to .csv produces a file that opens in Excel as a single column of markup, which is a worse mess than the one you started with.
If a text editor keeps opening it, you have two options. Change the association once, with right-click Open with > Choose another app, or take the deliberate route: open Excel first, then use Data > From Text/CSV, which gives you a preview and the delimiter and encoding choices before anything is loaded. Microsoft notes that a .csv opened by double-clicking goes straight into a workbook with the default data format applied to every column, with no prompt about the delimiter. The guide to opening a CSV in Windows covers that double-click behaviour and its consequences.
If the bytes are wrong, do not convert by hand. Get the export again from the system that produced it, and if you are stuck with a tab-separated or semicolon file, run it through the delimiter converter rather than using find-and-replace, which corrupts every value that contains a comma inside quotes.
If a website refuses it as the wrong type,rename to .csv after confirming the content, and check the delimiter at the same time. An upload that is rejected as "not a CSV" and an upload that succeeds but imports as one column are usually the same file problem seen at two different stages, and the eight reasons a CSV upload is rejected lists what the receiving side checks.
Frequently Asked Questions
Is a CSV file supposed to be a text file?
Yes. RFC 4180 registers the format as text/csv, a subtype of text, and describes records as sitting on separate lines separated by CRLF with commas between fields. There is no binary header, no column metadata and no cell types stored in the file. A CSV that opens in a text editor is behaving exactly as designed.
Why does my CSV show a Notepad or text file icon?
Windows picks the app and the icon from the extension, not from the contents. Microsoft's own description of extensions says they tell the computer which application can open the file and which icon to use. If .csv is associated with a text editor, or if the file is really named something.csv.txt, you get the text editor and its icon. Right-click the file and choose Open with, or check the name with file name extensions turned on.
Why is my file called data.csv.txt?
Something appended a second extension. The usual causes are a browser or server that described the download as text/plain, a text editor saving in plain-text mode while Windows hides extensions so the name looks unchanged in the dialog, or an export tool that adds .txt to a name that already ended in .csv. Rename it back to a single .csv once you have confirmed the contents are actually CSV.
How do I check whether a file is really a CSV?
Look at the first bytes. A real CSV starts with readable characters such as a header like id,name. A UTF-8 file with a byte order mark starts with EF BB BF. An HTML error page saved under a .csv name starts with 3C 21 44 4F, which is the text of a doctype. An .xlsx file renamed to .csv starts with 50 4B 03 04, the ZIP signature, because xlsx is a zipped package. The extension is a claim; the first bytes are evidence.
Why does a website reject my CSV as the wrong file type?
Because the type it sees usually comes from the extension, not from reading the bytes. RFC 4180 registers text/csv, but a file saved as .txt is reported as text/plain by the operating system, and an upload field that only accepts text/csv will refuse it. Renaming to .csv is enough when the content is already CSV; if the delimiter is also wrong, convert the delimiter first so the receiving importer does not open it as one long column.
Does converting a CSV to XLSX stop it being a text file?
Yes, in the sense that matters: XLSX is a ZIP package of XML parts, so it stores column names, types and formatting instead of just characters and commas. The trade is size and complexity. The guide to why a CSV can be larger than the equivalent XLSX covers that comparison with measured file sizes.
Sources
- RFC 4180, Common Format and MIME Type for CSV Files, section 2 (the seven formatting rules: CRLF records, optional header, equal field counts, quoting) and section 3 (registration of
text/csv; media type nametext; optionalcharsetandheaderparameters; "Common usage of CSV is US-ASCII"). Retrieved 2026-10-30. - Microsoft Support, Common file name extensions in Windows: file names have a name and a three- or four-character extension that defines the file type; extensions tell the computer which application can open the file and which icon to use;
csvis listed as "Comma-separated values file"; and the path View > Show > File name extensions for showing them in File Explorer. Retrieved 2026-10-30. - Microsoft Support, Import or export text (.txt or .csv) files: a .csv opened directly goes into a workbook and each column is interpreted with the default data format, without a delimiter prompt. Retrieved 2026-10-30.
- Local measurement, 2026-10-30: four files built with
printf, first bytes read in Python 3.13.5 withbinascii.hexlify, extension-to-type mapping taken frommimetypes.guess_type, CRLF counted as occurrences ofb"\r\n". Sizes and counts are reproduced in the table above.
Find Out What Your File Really Is
Drop it into the analyzer: it reports the delimiter, the encoding and the number of rows it actually parsed. If the file is HTML or a renamed workbook, the parse fails loudly instead of quietly producing one column.
Related reading
File Operations โ other guides that pair well with this one.
- Excel CSV Separator Setting: Why a Comma-Delimited File Has No Commas
- Sort CSV by Column
- CSV Delimiter in pandas: How to Set sep (and What Happens When You Don't)
- Convert CSV to PDF
Browse all guides in the NoCodeCSV blog.