FASTA File Statistics: Sequence Count, Length Distribution, and N50
When you receive an assembly result or a batch of sequences, the first thing to check is the basic summary statistics.
N50 is the most commonly misunderstood metric. The definition: sort all contigs by length from longest to shortest, accumulate lengths in order, and when the cumulative length first reaches half the total assembly length, the length of that contig is the N50. It measures assembly contiguity — a larger N50 means longer fragments account for a greater proportion of the assembly.
L50 is the number of contigs needed to reach half the total length. N50 and L50 are a pair, and they move in opposite directions.
Note that N50 has a well-known flaw: it is sensitive to total assembly length. If an assembly is missing a large number of short contigs, the total length shrinks and N50 actually looks better. N50 must therefore always be read alongside total length and sequence count — a single number in isolation is meaningless.
All calculations run entirely in the browser; sequences are never uploaded. For large files, work with a subset first.
How N50 is calculated: a small example
Five contigs with lengths 100, 80, 60, 40, 20; total length 300, half-length 150:
Cumulative 100 < 150
Cumulative 100+80 = 180 ≥ 150 ← first to reach half
N50 = 80 (length of that contig)
L50 = 2 (took 2 contigs)
N50 can be inflated — this is its biggest problem
Suppose an assembly consists of 100, 50 plus ten contigs of length 10:
| Assembly | Count | Total length | N50 |
|---|---|---|---|
| Complete | 12 | 250 | 50 |
| Short contigs dropped | 2 | 150 | 100 |
Nothing has improved — simply discarding short fragments doubles N50. Because the denominator of N50 is the assembly total length, when the total length shrinks the half-length threshold drops with it.
NG50 was designed to fix this
NG50 replaces the denominator with the estimated genome size rather than the assembly total length. Using the example above with a genome size of 250:
| Assembly | NG50 |
|---|---|
| Complete | 50 |
| Short contigs dropped | 50 |
With a fixed denominator, discarding fragments no longer helps. When comparing different assemblies, as long as the genome size estimate is consistent, NG50 is far fairer than N50. This tool reports N50/L50 (no extra input needed); to compute NG50, substitute your genome size estimate manually.
contig N50 and scaffold N50 are not the same thing
Scaffolds are built from contigs joined by runs of Ns, and their lengths include unknown bases. Scaffold N50 is typically much larger than contig N50; comparing the two numbers directly is meaningless. When reading assembly quality reports in the literature, first confirm which one is being reported.
FAQ
Is a higher N50 always better?
Only when total length and completeness are comparable. N50 is sensitive to total assembly length — discarding large numbers of short contigs inflates N50 artificially — so it must always be read alongside total length, sequence count, and a completeness metric such as BUSCO.
How large a file can this handle?
Browser memory is the limiting factor; files of a few tens of MB typically work fine. For a full mammalian genome, use a command-line tool locally.
Does a high N50 mean a good assembly?
Not necessarily. N50 measures contiguity, not correctness — incorrectly joining two non-adjacent sequences increases N50 while worsening the assembly. Evaluating assembly quality requires also checking the match between total length and the genome size estimate, completeness metrics such as BUSCO, and read-mapping consistency. N50 is necessary but not sufficient.
Why does my N50 differ from someone else's calculation?
Most likely the sequences included differ. Some pipelines filter out contigs below a length threshold (commonly 200 or 500 bp) before computing N50; others include all sequences. As noted above, filtering short fragments inflates N50. When reporting N50, always state whether a length threshold was applied and what value was used.
Related tools
Protein Molecular Weight, Isoelectric Point & 280 nm Extinction Coefficient Calculator
Enter an amino acid sequence to compute molecular weight, theoretical pI, molar extinction coefficient, and A280 at 1 mg/mL.
Pairwise Sequence Alignment Online Tool (Needleman-Wunsch Global Alignment)
Global alignment of two sequences with alignment output, score, percent identity, and mismatch/gap statistics.
Codon Table Quick Reference (Standard Genetic Code): Bidirectional Codon–Amino Acid Lookup
All 64 codons of the standard genetic code — look up amino acids by codon or reverse-query codons by amino acid; accepts both DNA and RNA notation.
Buy me a coffee