JSONL Merger

Combine multiple JSONL (JSON Lines) files into a single file. Reorder, deduplicate, and validate lines. 100% client-side, your data never leaves your browser.

Input Files

Drop .jsonl files here, or click to select multiple files

Supports .jsonl, .ndjson, .json, .txt

Merge Options

By Jerry FanUpdated February 2026

Why cat file1.jsonl file2.jsonl can corrupt your data

Concatenation looks like the obvious way to merge JSONL — and it works right up until one file lacks a trailing newline. Then the last record of one file and the first record of the next fuse into a single invalid line:

# file1.jsonl ends WITHOUT a trailing newline:
{"id": 1}
{"id": 2}⏎missing
# file2.jsonl:
{"id": 3}
# cat file1.jsonl file2.jsonl produces:
{"id": 1}
{"id": 2}{"id": 3} ← one broken line: parse error, two records lost

This tool checks every input's final byte and inserts the missing newline before joining — the merged output is always valid, regardless of how the inputs were saved. If you must use cat in a pipeline, the defensive form is: awk 1 file1.jsonl file2.jsonl (awk re-terminates every line).

How to Merge JSONL Files

Select or drag and drop multiple JSONL files into the upload area. Each file is read entirely in your browser — no data is sent to any server. Files can be in .jsonl, .ndjson, .json, or .txt format.

Once uploaded, you can reorder files using the up/down arrows to control the merge order. Enable deduplication to remove duplicate lines based on their full content, or enable JSON validation to skip lines that are not valid JSON.

The merged output appears in the preview panel showing the first 100 lines. Download the full merged file as a .jsonl file or copy it to your clipboard. Statistics show the total line count, file size, and any duplicates or invalid lines removed.

Merge semantics, precisely

Order
Files are concatenated in the order you add them, and record order within each file is preserved. Merging is append-only — records are never reordered, rewritten, or reformatted.
Boundary repair
A missing trailing newline at the end of any input is fixed automatically (see the example above). Blank lines between records are dropped, since some consumers reject them.
Deduplication: exact line
Optional. Two records count as duplicates only when their raw lines are byte-identical — {"a":1,"b":2} and {"b":2,"a":1} are NOT deduplicated, because key order makes the lines differ even though the JSON values are equal. Normalize with the formatter's sort-keys option first if you need value-level dedup.
Round-trip with the splitter
Merging is the exact inverse of splitting: split a file into N chunks, merge them back in order, and the result is byte-identical to the original (with dedup off). This property makes split → process in parallel → merge a safe pipeline pattern.

What is JSONL Merging?

JSONL merging is the process of combining multiple JSONL (JSON Lines) files into a single file. Each input file contains one JSON object per line, and the merger concatenates all lines from all files into one output file while preserving the order you specify.

This is essential when working with datasets split across multiple files — such as training data shards, daily log exports, or chunked API responses. Merging consolidates them into a single file for easier processing, analysis, or uploading to platforms that expect a single JSONL input.

Common Errors & Solutions

Duplicate Records Across Files

When merging overlapping JSONL exports (e.g., daily logs with overlapping timestamps), duplicates can occur. Enable the 'Remove duplicates' option to automatically deduplicate based on exact line content. For semantic deduplication (same data, different formatting), format all files consistently first using the JSONL Formatter.

Mixed Encoding Between Files

Files from different sources may use different character encodings (UTF-8, UTF-8 with BOM, Windows-1252). This can cause the first line of some files to fail JSON parsing. Ensure all files are saved as UTF-8 without BOM before merging.

Inconsistent Schemas Across Files

JSONL files from different sources may have different key structures. While the merger combines files regardless of schema differences, downstream tools may expect consistent schemas. Validate your merged output with the JSONL Validator to ensure each line is valid JSON.

Common Use Cases

Dataset Consolidation

Combine multiple JSONL training data shards into a single file for uploading to OpenAI fine-tuning, Hugging Face, or other ML platforms.

Data Pipeline Assembly

Merge output files from parallel data processing pipelines into a single JSONL file for downstream consumption.

ML Training Data Preparation

Consolidate prompt-completion pairs from multiple sources into one JSONL file ready for model fine-tuning.

Log File Aggregation

Combine daily or hourly JSONL log exports into a single file for comprehensive log analysis and searching.

Team Collaboration

Merge JSONL data files contributed by different team members into a unified dataset for shared analysis.

Analytics Data Merging

Combine JSONL event data from multiple services or time periods for unified analytics and reporting.

Frequently Asked Questions

What does a JSONL merger do?

Yes. All merging happens locally in your browser. No file data is uploaded to any server. Your JSONL files never leave your device.

Does this JSONL merger deduplicate identical lines?

There is no hard limit on the number of files. You can add as many JSONL files as needed. However, since all files are loaded into browser memory, very large combined datasets (several hundred MB) may be slower depending on your device.

Does the JSONL merger upload my files?

Deduplication compares the full trimmed content of each line. If two lines are identical (same characters, same order), the second occurrence is removed. This is exact-match deduplication — lines with the same data but different key ordering or whitespace are treated as different.

Can I merge NDJSON files too?

Yes. After uploading, use the up and down arrow buttons next to each file to reorder them. The merged output follows the file order from top to bottom.

Should I validate JSONL after merging?

Empty lines and whitespace-only lines are automatically filtered out during file reading. They do not appear in the merged output. This follows the JSONL specification where blank lines are ignored.

How do I split a merged JSONL file again?

Yes. The merger combines files regardless of schema differences. Each line is preserved exactly as-is. If you need schema consistency, validate or transform the files individually before merging.

Does merging preserve the original line order within each file?

Yes. Lines within each file maintain their original order. Files are concatenated in the order shown in the file list. You can adjust the file order before merging.

How is this different from manually concatenating files?

This tool provides a visual interface with drag-and-drop upload, file reordering, deduplication, JSON validation, line count statistics, and instant preview. Unlike manual concatenation with cat or copy commands, it handles edge cases like trailing newlines and empty lines automatically.

Related tools & guides