User Rating 0.0
Total Usage 0 times
Drop your CSV file here or browse Supports .csv and .tsv files up to 50 MB
Is this tool helpful?

Your feedback helps us improve.

About

Importing CSV data into SQLite without type validation produces TEXT-only columns. Queries against untyped columns bypass index optimizations and return incorrect results for numeric comparisons. This converter parses CSV files using a strict RFC 4180 finite-state machine, auto-infers column types (INTEGER, REAL, TEXT) by statistical sampling, and generates both executable SQL scripts and binary .sqlite database files. Empty fields map to NULL rather than empty strings. Single quotes in values are escaped per SQL standard as ''.

The type inference engine samples up to 100 rows and requires a 90% match rate (excluding blanks) before promoting a column from TEXT to a numeric type. This threshold prevents misclassification from occasional non-numeric entries like placeholder dashes or units embedded in cells. Column types can be manually overridden before export. The tool processes files entirely in your browser. No data leaves your machine.

csv to sqlite csv converter sqlite database sql generator csv import data conversion csv parser

Formulas

The CSV parser operates as a Finite State Machine with four states. Each character c at position i triggers a state transition:

FSM(c, state) state

State set S = { FIELD_START, UNQUOTED, QUOTED, QUOTE_IN_QUOTED }. On FIELD_START: if c = """, transition to QUOTED; if c = delimiter, emit empty field; otherwise enter UNQUOTED and append. On QUOTED: if c = """, transition to QUOTE_IN_QUOTED; otherwise append. On QUOTE_IN_QUOTED: if c = """, append literal quote and return to QUOTED; if c = delimiter or newline, emit field.

Type inference uses a threshold function for each column j:

typej =
{
INTEGER if matchintnon_empty 0.9REAL if matchrealnon_empty 0.9TEXT otherwise

Where matchint counts cells matching ^-?\d+$, matchreal counts cells matching the integer or floating-point pattern, and non_empty is the count of non-blank cells in the sample of up to 100 rows. Integer check runs first; if it passes, REAL is not tested.

Reference Data

CSV FeatureRFC 4180 RuleThis Converter
DelimiterComma (,)Auto-detect or manual: comma, semicolon, tab, pipe
Quoted FieldsEnclosed in double quotesFull support, preserves inner content
Escaped Quotes"" inside quoted fieldConverted to single " in output
Newlines in FieldsAllowed inside quotesPreserved as \n in SQL strings
Header RowOptional (first record)Toggle on/off; auto-generates col_N names
Trailing CRLFOptional on last recordStripped, no empty trailing row
BOM (Byte Order Mark)Not specifiedUTF-8 BOM auto-stripped
Empty FieldsAllowed (,,)Mapped to NULL in SQLite
Mixed Line EndingsCRLF recommendedHandles CRLF, LF, and CR
Whitespace TrimmingNot specifiedOptional toggle (default: trim)
Type: INTEGERN/APattern: ^-?\d+$
Type: REALN/APattern: ^-?\d*\.\d+([eE][+-]?\d+)?$
Type: TEXTN/AFallback for all non-numeric columns
SQL EscapingN/ASingle quotes doubled: '''
Table NameN/ADerived from filename, sanitized to [a-zA-Z0-9_]
Max ColumnsNo limitSQLite limit: 2000 columns
Max File SizeN/ARecommended < 50 MB for browser stability
EncodingNot specifiedUTF-8 (browser default via FileReader)
NULL HandlingNo standardEmpty field → NULL; quoted empty → empty string ''
Column Name SanitizationN/ANon-alphanumeric chars replaced with _, quoted in SQL with "

Frequently Asked Questions

The engine samples up to 100 non-header rows. For each column, it counts how many non-empty cells match the INTEGER pattern, then the REAL pattern. If 90% or more of non-empty cells match INTEGER, the column is typed INTEGER. If that fails but 90% match REAL (including integers), it becomes REAL. Otherwise it falls back to TEXT. A column like zip codes (e.g., '02134') with a leading zero fails the numeric test because the parsed integer would lose the zero - these correctly remain TEXT. You can override any inferred type before export.
Unquoted empty fields (two consecutive delimiters like ',,') are converted to SQL NULL. A quoted empty field ('""') is stored as an empty string '' - this follows the distinction that quoting an empty value is an intentional empty string, while an unquoted gap represents missing data. This matters for queries using IS NULL vs = '' conditions.
Yes. The parser counts columns from the first row (or header row if enabled). Rows with fewer fields than expected are padded with NULL values. Rows with more fields than expected have the extra fields silently dropped. A warning counter in the UI shows how many rows were adjusted, so you can verify data integrity.
Files under 50 MB process reliably in modern browsers. The parser runs in a Web Worker thread to keep the UI responsive. For files approaching the 50 MB threshold, the tool shows a progress indicator. Beyond 50 MB, memory pressure depends on your device - a machine with 8 GB RAM can typically handle 100+ MB. The .sqlite binary export via sql.js WASM consumes additional memory roughly equal to the database size. If you hit limits, split the CSV externally.
Column names are sanitized: non-alphanumeric characters (except underscores) are replaced with underscores. The resulting name is then double-quoted in the CREATE TABLE statement per SQL standard (e.g., "my_column_1"). This ensures names starting with digits, containing spaces, or matching SQL reserved words (like "order" or 'group') do not cause syntax errors.
The .sql file is a plain text script containing CREATE TABLE and INSERT INTO statements. You can open it in any text editor, review the SQL, and execute it in any SQLite client (or MySQL/PostgreSQL with minor syntax adjustments). The .sqlite file is a binary SQLite3 database ready to open directly in tools like DB Browser for SQLite, Python's sqlite3 module, or any SQLite-compatible application. The binary file is generated using sql.js, a WebAssembly build of SQLite3 running in your browser.