All protocols

Trim adapters and low-quality bases with fastp

Quality- and adapter-trim paired- or single-end FASTQ reads with fastp, producing gzipped outputs plus HTML and JSON QC reports.

SSSudipta SardarUpdated July 21, 2026

Prerequisites

  • fastp installed (e.g. `conda install -c bioconda fastp`)
  • Paired-end or single-end FASTQ files (optionally gzipped)

1Trim paired-end reads

Point fastp at both mates and give it output paths for each. fastp auto-detects adapters, quality-trims, and writes an HTML and JSON report in one pass.

bash
fastp -i R1.fastq.gz -I R2.fastq.gz -o R1.trimmed.fastq.gz -O R2.trimmed.fastq.gz -h fastp.html -j fastp.json

Expected output

Read1 before filtering:
total reads: 1000000
total bases: 151000000
Q20 bases: 145830000(96.5762%)
Q30 bases: 138920000(91.9603%)

Read2 before filtering:
total reads: 1000000
total bases: 151000000
Q20 bases: 143210000(94.8411%)
Q30 bases: 134500000(89.0728%)

Filtering result:
reads passed filter: 1943210
reads failed due to low quality: 52148
reads failed due to too many N: 214
reads failed due to too short: 4428
reads with adapter trimmed: 215640
bases trimmed due to adapters: 3184092

Duplication rate: 8.24%

Insert size peak (evaluated by paired-end reads): 187

JSON report: fastp.json
HTML report: fastp.html

fastp v0.23.4, time used: 37 seconds

2Trim single-end reads

For single-end data, drop the -I and -O flags and pass just one input and one output. Everything else, including adapter detection and reporting, works the same.

bash
fastp -i reads.fastq.gz -o reads.trimmed.fastq.gz -h fastp.html -j fastp.json

Expected output

Read1 before filtering:
total reads: 1000000
total bases: 151000000
Q20 bases: 145830000(96.5762%)
Q30 bases: 138920000(91.9603%)

Read1 after filtering:
total reads: 971605
total bases: 143820140
Q20 bases: 141905331(98.6683%)
Q30 bases: 136402118(94.8419%)

Filtering result:
reads passed filter: 971605
reads failed due to low quality: 26072
reads failed due to too many N: 107
reads failed due to too short: 2216
reads with adapter trimmed: 107820
bases trimmed due to adapters: 1592046

Duplication rate (may be overestimated since this is SE data): 7.91%

JSON report: fastp.json
HTML report: fastp.html

fastp v0.23.4, time used: 19 seconds

Troubleshooting

Adapters not auto-detected (common with short or unusual libraries)

Pass the adapter explicitly with `--adapter_sequence AGATCGGAAGAGC`, adding `--adapter_sequence_r2 AGATCGGAAGAGC` for read 2 in paired-end runs.

Too many reads discarded

Quality filtering is on by default at `-q 15` and `-u 40`, so re-passing those values changes nothing. To actually loosen it, lower the phred cutoff and allow more low-quality bases, e.g. `-q 10` (minimum phred) and `-u 50` (percent of low-quality bases allowed), or turn it off entirely with `--disable_quality_filtering`.

References