CSV to TypeScript converter
Convert CSV to TypeScript: a type for the rows of a CSV file, with each column typed from its values.
What you get
- A TypeScript type from CSV: a CSV to TypeScript interface for the rows, with each column typed from its values.
- Checked by the TypeScript compiler: every row type-checks against the type in strict mode.
- Typed CSV rows for your code: parse the file, then use the generated type for each row.
- Private and free: everything runs in your browser, nothing is uploaded, and there is no sign-up.
How each result is checked
- Step 1: The CSV is parsed with a strict parser that reports broken quotes.
- Step 1: Every cell in the JSON is compared with the original cell text; nothing may change.
- Step 2: The generated code is compiled with the real TypeScript compiler in strict mode.
- Step 2: Your JSON itself is type-checked against the root type. It must pass.
What can't convert exactly
- Number detection only converts values whose text stays identical, so 007, 1.50 and very long IDs stay text.
- Duplicate or empty header names are renamed, with a warning.
- Types can only describe what the sample shows. A field that is null in every sample is typed as null; add a sample with a real value for a better type.
- Paste an array with several records to detect which fields are optional.
- Numbers are typed as number. Use the Zod converter if you need to check whole numbers at runtime.
Questions
How is a two-step conversion checked?
Your input is converted to JSON first, then to the target format. Each step has its own independent check, and both must pass. The checks of both steps are listed under every result.
Is my data uploaded?
No. Everything runs in your browser, in a background worker. Nothing is sent to a server.
How do I convert CSV to TypeScript online?
Paste your CSV or open a file on the left (or click Example). The TypeScript appears on the right as you type, already checked. Copy it, or download it as a file. Nothing is uploaded.
Can the TypeScript output be wrong?
Every result is checked before it is shown (the checks are listed on this page). If a check fails, the page says "Review needed" and why, instead of presenting the output as correct, and anything that cannot convert exactly is named in the notes.