The quick answer

Flip the toggle to CSV → JSONL, paste, and each data row becomes one JSON object on its own line: header cells are the keys, number-like cells and lowercase true/false are auto-typed, empty cells become null. The built-in sample, name,age with Ana,30 and Ben,25, yields 2 lines downloadable as data.jsonl. Watch numeric text: 02134 becomes 2134. Nothing uploads.

The format every pipeline wants

JSON Lines is the freight container of machine data. Log pipelines ship it, vector databases ingest it, and every fine-tuning interface accepts training data as one JSON object per line. CSV, meanwhile, remains what humans actually have. This converter is the bridge: paste the spreadsheet, get a .jsonl file the pipeline will take.

The conversion itself is not hard, and the judgment calls are the real subject: when 42 should become the number 42 versus stay the string "42", what an empty cell means, what happens to leading zeros and ragged rows. This page documents those decisions exactly as the tool behaves, including the one control on the page that does not do anything yet.

CSV to JSON Lines in five steps

The converter sits above this section. The standard run:

  1. Load the CSV

    Paste into the input box, or click the file picker to load a .csv, .jsonl or .txt from disk; the file is read locally with the browser's File API and never uploaded. Comma is the only delimiter: the picker contains tab-detection code, but it is not wired, so a tab-separated file parses as one fat column. RFC 4180 quoting is honored, so fields containing commas, quotes and line breaks parse intact, which matters for answer columns.

  2. Confirm direction, and know the header rule

    The CSV → JSONL pill is on by default, and the second pill switches to JSONL → CSV for the reverse trip. The header button beside them is the page's dormant control: flipping it between "First row is a header" and "No header row" changes the label and nothing else. The conversion always consumes row 1 as the key source, so a headerless file needs a header row added first.

  3. Read the note

    The note under the output states the inference policy in one line: numbers and booleans are auto-typed, empty cells become null. The table in the next section is the complete rulebook behind that line, read once and no conversion surprises you.

  4. Watch the output

    One JSON object per line appears live as you type. The preview under the buttons truncates at 20,000 characters, but Copy result and Download always carry the full file. Scan a few lines before downloading, especially zip-style columns (02134 becomes 2134) and Yes/No columns (they stay strings).

  5. Download or copy

    Save data.jsonl or copy the text directly. Each line is a complete, independently valid JSON object in your original column order, ready for the pipeline.

Type inference: when 42 becomes 42

CSV cellJSON outputRule
4242Integer syntax converts (optional minus sign)
3.143.14Decimal syntax converts
-7-7Negative integers convert
007 / 021347 / 2134Numeric-looking text converts, and the leading zero is gone because JSON numbers cannot carry it; post-process zip-style columns if the zero matters
1e3"1e3"Exponent notation is not matched by the rule; stays a string
true / falsetrue / falseThe exact lowercase spellings convert to booleans
TRUE / Yes"TRUE" / "Yes"Non-lowercase spellings stay strings; YES meaning true is a guess the tool does not make
"42" with a stray spacestringValues are matched exactly, without trimming: one leading or trailing space makes the number a string
(empty)nullEmpty cell means missing data; every empty cell becomes null
NaN / Infinity"NaN" / "Infinity"Not matched by the number rule, and not legal JSON numbers; they stay strings
Conservative by design: every conversion rule is lossless, and every non-conversion has a stated reason.

Booleans deserve the same candor. Spreadsheets export checkboxes as TRUE and FALSE, surveys export Yes and No, and only the lowercase true and false are JSON booleans. This converter types exactly the lowercase spellings and leaves TRUE, FALSE, Yes and No as strings, so YES meaning true stays your call. If your pipeline wants real booleans from a Yes/No column, clean the column before converting.

Worked example: a training file takes shape

First the plain-record mode, on a small customer file with a leading-zero column, a boolean, and a blank cell: the three judgment calls in one place.

Plain records with type inference

Input

name,age,active,zip,referral
Ana,29,true,02134,
Luis,41,false,90210,TV ad

Output

{"name":"Ana","age":29,"active":true,"zip":2134,"referral":null}
{"name":"Luis","age":41,"active":false,"zip":90210,"referral":"TV ad"}

Note: numbers and booleans are auto-typed; empty cells become null. The zip column lost its leading zero; see the type-inference table above.

Note what happened to each judgment call: ages became numbers, the booleans converted because the CSV used the exact lowercase spellings, and Ana's missing referral became null. Look at the zip column too: 02134 went in and 2134 came out, because the number rule matches it and JSON numbers cannot carry a leading zero. That is the one trap this converter does not dodge, so zip-style and code columns need a post-conversion find-and-replace if the zeros matter. Each output line is a complete, independently valid JSON object, the property that makes JSONL streamable in the first place.

Now the fine-tuning shape. The chat APIs want records with a messages array of role/content pairs, one per line, and this converter gives you the substrate for that: a two-column question/answer CSV becomes one {"question": ..., "answer": ...} object per line, keys straight from your header. Wrapping those into the messages layout is a ten-line script over the .jsonl, or one pass with the JSON tools on this site.

Question/answer records, the fine-tuning substrate

Input

question,answer
What is the refund policy?,Refunds are processed within 14 days of delivery.
Do you ship to Canada?,Yes, all provinces, with duties prepaid at checkout.

Output

{"question":"What is the refund policy?","answer":"Refunds are processed within 14 days of delivery."}
{"question":"Do you ship to Canada?","answer":"Yes, all provinces, with duties prepaid at checkout."}

Same conversion, header-supplied keys; wrap into a messages array afterward if your fine-tuning API wants that shape.

CSV to JSONL for LLM fine-tuning

The recent wave of demand for this conversion comes from fine-tuning: preparing domain-specific chat behavior from examples that live in spreadsheets. The canonical layout, messages arrays with role/content pairs one per line, is documented by the fine-tuning guides of the major providers. This converter produces the one-object-per-line base those layouts are built on, with your header row as the keys; the role-mapping step is deliberately left to you, because it is where every provider's schema differs.

The prep work that determines whether fine-tuning succeeds happens mostly before conversion, and it is spreadsheet work: deduplicate examples (models learn duplicated answers too well), strip trailing whitespace and stray encoding artifacts, balance the categories so the model is not trained on 95 percent one class, and check that answers do not contain the template's own boilerplate. The CSV Deduplicator handles the first, the CSV Value Frequency Counter answers the balance question with a two-column count, and eyeballing a few output lines catches encoding debris before it reaches the pipeline.

Dataset size expectations, for calibration: demonstration datasets that teach a style or a narrow behavior often run in the hundreds to low thousands of examples, and a 2,000-row spreadsheet converts to a 2,000-line .jsonl in seconds here. The bottleneck is data quality, not conversion.

JSON versus JSONL versus NDJSON

PropertyJSON arrayJSONL / NDJSON
Overall structureOne document: [ {...}, {...} ]Many one-line documents
Can you append?No; the closing bracket is in the wayYes; append a line and done
Streaming readOnly with special streaming parsersLine by line, trivially
Partial corruptionOne syntax error kills the whole fileOne bad line; the rest parse fine
Human diffingReordering is invisible in diffsLine-aligned diffs work naturally
Size on diskSmallest raw (no repeated structure)Slightly larger, but compresses better
Why pipelines standardized on lines: appendability, streamability and damage containment.

The damage-containment row is the one that earns JSONL its place in production. A malformed record in a JSON array invalidates the entire document, while the same record in a JSONL file is one skipped line: a log shipper drops it, notes it and moves on. For training data the property matters twice over, because you can validate a 100,000-line file line by line and actually find the three bad examples.

Edge cases: ragged rows, nulls, and encoding debris

The inputs that make converters earn their keep:

  • Ragged rows: a data row with fewer fields than the header gets null for the missing trailing keys, and a row with extra fields has the overflow dropped. Check wide-but-short rows against your header before trusting the output, because silent truncation is how training data loses its labels.
  • Duplicate headers: two columns named content collide on one key and the last value wins, so the earlier column's data disappears from every line. Rename duplicates in the source first; it is a one-minute fix that saves the whole column.
  • Blank header cells: a column with no name becomes the key col0, col1 and so on by position. If your output starts showing col keys, the header row has holes in it.
  • The BOM: a UTF-8 byte-order mark at the file's start rides into the first header name, producing an escaped \ufeff prefix on that key. If your first key looks odd, that is why; save the CSV without BOM and re-convert.
  • Smart quotes and encoding artifacts: curly quotes from Word exports are valid UTF-8 and pass through correctly, while mojibake like é means the source file itself was double-encoded upstream. Fix it in the source, because no converter can guess the original bytes.
  • Embedded newlines inside quoted fields: legal CSV, and the output emits them as \n escapes inside JSON strings, so the line-per-record property survives because the newline lives inside a quoted string, never as a line break.
  • Very long single lines: a conversation record with a 50 KB answer is still one line and still valid. Line length is not a JSONL constraint, though some downstream tooling imposes its own limits.

Who converts CSV to JSONL

Demand for CSV to JSONL used to be a niche, and it is not anymore. ML engineers preparing fine-tuning and evaluation sets are the fastest-growing audience; data engineers feed vector databases and RAG ingestion pipelines, where documents-plus-metadata rows become per-line records for embedding jobs; backend developers migrate spreadsheets into log streams and event queues, where every consumer speaks lines. The shared motive is the destination's appetite: somewhere downstream wants lines, and the source is a spreadsheet.

csvkit versus this page

RouteBest forCosts
csvkit (csvjson)Scripted, repeatable conversions inside data pipelinesInstall and environment; JSON-lines mode needs flags; no interactive review of inference decisions
Python/pandas one-linerFull control over dtype handlingdtype guessing is its own famous trap; int64 columns and leading-zero strings misbehave without explicit settings
This converterInteractive work, one-off files, no environment, private dataOne file at a time; no scripting
Command line for pipelines you own; browser for files in your hand.

The pandas row is not a cheap shot: its dtype inference converts zip codes with leading zeros to integers unless the user passes dtype=str, and this converter makes the same call on numeric-looking cells. The difference is whether the rules are documented where you can read them before the data hits the pipeline.

Local processing, zero uploads

For teams preparing proprietary datasets, the local design simplifies compliance rather than just improving it: no data leaves the boundary, so there is no third-party processor to document, no DPA to sign, and no question to answer in a security review. The conversion happens where the data already lives, JavaScript in the tab with files read from disk through the browser's File API.

Frequently asked questions

What is the difference between JSONL and NDJSON?

Nothing functional: they are two names for the same layout, one complete JSON value per line, UTF-8, newline-separated. JSON Lines is the name used by the jsonlines.org spec; NDJSON (newline-delimited JSON) is the name used by its own spec on GitHub. Tools and documentation use the terms interchangeably, and a file that satisfies one satisfies the other.

Does the key order in each JSONL line follow my CSV columns?

Yes. Line one's keys appear in the order your header row lists them, and every subsequent line follows the same order. JSON objects are formally unordered, but consistent ordering matters for humans diffing training files and for byte-level file comparisons, so the converter preserves column order faithfully.

What does the header button on the page do?

It flips its own label between "First row is a header" and "No header row", and nothing else: the conversion is identical either way. Row one always supplies the keys and is always excluded from the data, so the control is not wired in the current build. A headerless file needs a header row added before pasting, and this page states that fact rather than pretending the toggle works.

How large a CSV can it convert?

There is no quota, because there is no server: the practical limit is your tab's memory. The preview under the buttons truncates at 20,000 characters, but the Copy result button and the Download button always emit the complete file. The output is plain text, so it compresses well once you gzip it yourself for storage or transfer.

Is my data uploaded during conversion?

No. Parsing, type inference and serialization all run as JavaScript in your browser, and the file picker reads your file with the browser's local File API. Nothing is transmitted, stored or logged, which for training data containing customer conversations or proprietary content is the entire point of doing this client-side.