CSV Type Sniffer

Infer the likely .NET type and format hint for each CSV column.

Open tool

Overview

The CSV type sniffer scans each column and suggests the most specific .NET type that fits the data — int, long, decimal, bool, DateTime, Guid, or string — along with a format hint where it helps (date format, number culture). Paste a sample and immediately see what types your data importer should declare.

Backend developers building strongly-typed parsers, ETL engineers writing schemas, and anyone seeding a typed model from a CSV reach for a csv type inference tool to skip the eyeballing-and-guessing step. It also surfaces mixed-type columns that would silently break a strict parser.

How it works

For each column the sniffer tries a chain of parsers in order of specificity: bool.TryParse, int.TryParse, long.TryParse, decimal.TryParse, DateTime.TryParseExact against a list of common formats, and Guid.TryParseExact. The narrowest type that succeeds for every non-blank value wins; if a single cell breaks the pattern, the column falls back to the next-broader type and ultimately to string.

Date parsing tries ISO 8601 first, then MM/dd/yyyy, dd/MM/yyyy, and yyyy-MM-dd HH:mm:ss variants. The hint returned tells you which format matched so you can pass it to DateTime.ParseExact in code.

Examples

Input:
id,joined,active
1,2024-01-15,true
2,2024-02-03,false
3,2024-03-22,true

Output:
id      int
joined  DateTime (yyyy-MM-dd)
active  bool
Input:
sku,price
A-001,9.99
A-002,12.50
A-003,N/A

Output:
sku    string
price  string  (mixed: 2 decimal, 1 non-numeric)

FAQ

How are nullable columns reported?

If a column has blank cells alongside otherwise-typed data, the sniffer reports the type with a ? suffix (int?, DateTime?) so the consuming code knows to allow null.

Can it tell int from long automatically?

Yes. If all values fit in Int32 it suggests int; if any exceeds the 32-bit range it widens to long. Same logic for decimal vs doubledecimal is preferred when fractional precision matters and values fit.

What if the data uses comma decimal separators?

European number formats are detected by sampling. If commas dominate the decimal position and dots are absent or used as thousands separators, the hint specifies de-DE or fr-FR culture for the parser.

Try CSV Type Sniffer

An unhandled error has occurred. Reload ×