SeqBench

Phred Quality Scores in FASTQ, Explained

6 min read · Updated June 8, 2026

Bar chart of per-base Phred quality scores declining across a sequencing readQ30Q20read position →Phred quality

FASTQ is the format almost all sequencing data arrives in, and it carries a quality score for every single base. If you've ever been confused by the wall of symbols on the fourth line, or by what N50 actually means, this guide is for you.

The four lines of a FASTQ record

  1. A header line starting with '@' that names the read.
  2. The sequence of bases.
  3. A separator line starting with '+' (optionally repeating the header).
  4. A quality line with one character per base, encoding the Phred score.

Phred quality scores

A Phred quality score Q expresses the probability that a base call is wrong: Q = −10 × log10(P_error). So Q20 means a 1-in-100 chance of error (99% accuracy), Q30 means 1-in-1000 (99.9%), and Q40 means 1-in-10,000. Q30 is a common quality threshold for trusting a base.

How the quality line is encoded

Each Phred score is stored as a single ASCII character by adding an offset. Modern data uses Phred+33 (Sanger / Illumina 1.8+), where a score of 0 is the character '!'. Older Illumina data (1.3–1.7) used Phred+64. Picking the wrong encoding shifts every score by 31, so it matters to choose correctly when summarising quality.

What N50 tells you

N50 summarises a length distribution — typically of contigs in an assembly or of reads. It is the length L such that half of all bases sit in sequences of length L or longer. A higher N50 generally means a more contiguous assembly, though it should always be read alongside total size and the number of sequences.

Worked example: decoding a quality string by hand

Here's a full decode of a single 10-base read using Phred+33 (Sanger / Illumina 1.8+) encoding — the same arithmetic a tool like FastQC or seqkit runs internally, done by hand.

  1. Sequence (5'→3'): ACGTACGTAC
  2. Quality (Phred+33): IIIIFF52#!
  3. Positions 1–4, char 'I': ASCII 73 − 33 = Q40 → P(error) = 10⁻⁴ = 0.0001
  4. Positions 5–6, char 'F': ASCII 70 − 33 = Q37 → P(error) = 10⁻³·⁷ ≈ 0.0002
  5. Position 7, char '5': ASCII 53 − 33 = Q20 → P(error) = 10⁻² = 0.01
  6. Position 8, char '2': ASCII 50 − 33 = Q17 → P(error) = 10⁻¹·⁷ ≈ 0.02
  7. Position 9, char '#': ASCII 35 − 33 = Q2 → P(error) = 10⁻⁰·² ≈ 0.63
  8. Position 10, char '!': ASCII 33 − 33 = Q0 → P(error) = 10⁰ = 1.0

Why 'average quality' can be misleading

Two different ways of summarising this same read's overall quality give very different answers. The plain arithmetic mean of the ten Q values — (40+40+40+40+37+37+20+17+2+0) / 10 — comes out to 27.3, which reads as a perfectly usable read. But Q is a logarithmic transform of an error probability, so averaging Q directly is not the same as averaging the error rate. Converting every character back to P(error), averaging those ten probabilities (mean ≈ 0.166), and converting that mean back to a Phred-like score gives Q ≈ 7.8 — a roughly 83% predicted per-base accuracy, well short of the Q20 (99% accuracy) threshold most pipelines treat as a bare-minimum cutoff for a trustworthy base. The gap exists because the two worst bases at the 3' end (Q2 and Q0, a 63% and a 100% predicted error respectively) get diluted to near-nothing when averaged in Q-space, but dominate the true error rate once averaged in probability space.

This is exactly why quality trimming looks at the position-by-position trace (or a sliding window) rather than a single mean-quality number: dropping just the last two bases of this read (the '#!' tail) leaves an 8-base stretch whose worst quality is Q17 — shorter, but far more trustworthy than either summary statistic on its own suggests.

N50, NG50, L50 and N90 — the terms people mix up

N50 rarely travels alone — assembly reports and papers often throw in L50, N90 or NG50 without explaining how they relate. One worked example ties all four together.

  1. Take an assembly with five contigs: 5,000, 4,000, 3,000, 2,000 and 1,000 bp (total = 15,000 bp), already sorted longest to shortest.
  2. Add them up until the running total passes half the assembly (7,500 bp): 5,000 (not yet) → +4,000 = 9,000 (passed). The contig that tips it over is 4,000 bp, so N50 = 4,000 bp.
  3. L50 is how many contigs it took to get there — 2 contigs were needed, so L50 = 2. N50 is a length; L50 is a count of pieces, and the two are easy to swap by mistake.
  4. N90/L90 use the same running total against 90% of the assembly (13,500 bp): 5,000 + 4,000 + 3,000 + 2,000 = 14,000 passes it, so N90 = 2,000 bp and L90 = 4.

NG50 and contig vs. scaffold vs. read N50

NG50 changes the denominator instead of the numerator: it uses half of an estimated or reference genome size, not half of the assembly's own total length. That matters because a fragmented assembly that only reconstructed 60% of a genome can still post an impressively high N50 relative to the little it assembled; NG50, measured against the full expected genome size, exposes that most of the genome is simply missing — it's the fairer number when comparing assemblies of different completeness.

The other common mix-up is which kind of sequence is being measured. Contig N50 is computed over gap-free contiguous sequence; scaffold N50 is computed after contigs are joined and oriented using long-range linking information (paired-end, mate-pair or long reads), with gaps typically shown as runs of N — so scaffold N50 is usually larger than contig N50 for the same assembly. Read N50, common in long-read sequencing QC (Nanopore and PacBio run reports), applies the identical formula to the raw reads themselves rather than to anything assembled — a throughput metric, not an assembly-quality one, despite sharing the name.

Common mistakes with FASTQ, quality scores and N50

  • Silently mixing Phred+33 and Phred+64 files — concatenating an older dataset with a modern one, or misconfiguring a tool's encoding option, shifts every quality score by 31 without raising an error, quietly corrupting every downstream quality-based decision (trimming thresholds, variant filters, reported mean quality).
  • Judging a whole read by a single mean-quality number. As shown above, a read can carry a reassuring mean Q while a short low-quality stretch (typical at the 3' end of long Illumina reads, or wherever adapter read-through begins) pushes the true error rate far higher than that headline figure implies.
  • Comparing N50 between assemblies without checking total assembled length or genome completeness first. A smaller, more fragmented assembly can post a higher N50 than a better one simply because it only assembled the easy, repeat-free fraction of the genome — read N50 alongside total length and, if a genome-size estimate exists, NG50.
  • Treating every 'N50' in a report as the same statistic. Contig N50, scaffold N50 and read N50 measure different things and are not interchangeable, even though tools and papers often print just 'N50' without saying which.

Frequently asked questions

What does a Phred score of 30 mean?

Q30 corresponds to a 1-in-1000 probability that the base call is incorrect — 99.9% accuracy. It is a widely used threshold for high-quality bases.

How do I know if my FASTQ uses Phred+33 or Phred+64?

Almost all current data is Phred+33. Phred+64 was used by older Illumina pipelines (1.3–1.7). If quality characters include '!' through ':' the data is Phred+33; choosing the wrong offset shifts every score by 31.

Is averaging the Phred scores in a read the same as its overall error rate?

No, not exactly. Q is a logarithmic transform of a probability, so the arithmetic mean of several Q values is not the same as the Q value that corresponds to the mean error probability — averaging Q directly systematically overstates quality when a read mixes mostly high-quality bases with a few very poor ones. To summarise accurately, convert each Q to P(error) = 10^(−Q/10), average those probabilities, then convert the average back to a Q-like number if you want a single figure.

What is L50, and how is it different from N50?

N50 is a length: the size of the contig (or scaffold) at which half the total assembly is contained in equal-or-longer pieces. L50 is a count: the minimum number of contigs needed to reach that halfway point. For example, N50 = 4,000 bp with L50 = 2 means just two contigs together account for half the assembly — a highly contiguous assembly has a high N50 and a low L50.

Does a Phred score of 0 mean the base call is guaranteed to be wrong?

Mathematically, yes — Q0 decodes to P(error) = 10^(−0/10) = 1, a 100% predicted error probability, which is why it sits at the bottom of the scale (ASCII '!' in Phred+33). In practice, true Q0 rarely appears on an actively base-called position in real data; it more often shows up as a placeholder for masked, padded or otherwise unscored bases.

Related references

Related tools

Related guides