Before you start
- You have a count matrix in mind; see From Reads to a Count Matrix.
- Any term new? The Glossary has it.
Learning objectives
By the end of this lesson you will be able to: explain why raw counts cannot be compared directly, say what CPM, FPKM, and TPM each correct for, explain why TPM is a within-sample unit that can mislead when you compare samples, choose the right values for comparing samples, and state the rule that DESeq2 and edgeR must receive raw integer counts, not normalized values.
Why raw counts are not comparable
A raw count is simply the number of reads that mapped to a gene. Two things make raw counts unfair to compare. First, library size (sequencing depth): if sample A was sequenced twice as deeply as sample B, every gene in A will tend to show roughly twice the counts, even when nothing biological changed. Second, gene length: a long gene is a bigger target, so it collects more reads than a short gene at the same true expression level. Because of these two effects, you cannot read a count of 800 in one place and 400 in another and conclude that the first is twice as active.
Two confoundersDepth and length
Depth (library size) makes whole samples scale up or down together. Gene length makes long genes look more expressed than short ones within a sample. Each normalization method removes one or both of these.
1What each method corrects for
CPM (counts per million) divides each count by the library size and multiplies by a million. It corrects for depth only, so it still treats a long gene as if it were more expressed than a short one. RPKM and FPKM (the F is for fragments, used with paired-end reads) correct for depth and gene length. TPM (transcripts per million) also corrects for both, but in an order that gives it a tidy property: within every sample, all TPM values add up to the same total (one million). So a TPM value is simply a gene's share of that sample's transcripts. That makes TPM easier to read than FPKM inside one sample.
| Method | Corrects depth? | Corrects gene length? | Best used for |
|---|---|---|---|
| CPM | Yes | No | Quick checks and filtering out genes with very low counts |
| FPKM / RPKM | Yes | Yes | Older reports; comparing genes within one sample. TPM has replaced it |
| TPM | Yes | Yes | Comparing genes within one sample; reporting expression levels. Not reliable across samples whose RNA mix differs |
| DESeq2 median-of-ratios (or edgeR TMM) | Yes, and also corrects for differences in RNA mix | No (the same gene is compared, so length cancels out) | Comparing the same gene across samples, and differential expression. Computed from raw counts |
2The TPM trap: comparing samples
Because TPM is a share, it is tempting to think a gene's TPM in sample A and sample B can be compared directly. Researchers do this often, and a 2020 review in the journal RNA calls it a common misconception. The problem is that a share depends on everything else in the sample.
Imagine one gene, like hemoglobin (HBB) in a blood sample, suddenly makes up most of the RNA in sample B. TPM must still add up to one million. So every other gene's share shrinks, even though nothing happened to those genes. Their TPM drops, and it looks like they went down.
The same thing happens when samples differ in how much ribosomal or mitochondrial RNA they contain, when they come from different tissues, or when they were prepared with different library protocols (for example poly(A) selection vs rRNA depletion). In all these cases the RNA mix (also called composition) differs, and TPM values stop being comparable.
DESeq2's median-of-ratios and edgeR's TMM were built for this. They assume that most genes do not change between samples, and they scale each sample using those stable genes. One very abundant gene cannot drag everything else down. In a study of tumor replicates, these normalized counts kept replicates of the same tumor together far better than TPM or FPKM did.
Try it yourself. The code below builds the hemoglobin example and compares TPM with DESeq2-style normalized counts. Press Run, then change the numbers and run it again.
Rule of thumb
Comparing genes within one sample? TPM is fine. Comparing the same gene across samples? Use DESeq2 or edgeR normalized counts. If you are handed only TPM from a database, compare samples only when they used the same protocol and have a similar RNA mix, and treat the result as a rough guide.
3The rule that keeps DESeq2 happy
This is the part beginners get wrong most often. For differential expression, DESeq2 and edgeR do their own normalization internally, the median-of-ratios method in DESeq2 and TMM in edgeR, and they must be given raw integer counts. Never feed them CPM, FPKM, or TPM. Those values are already scaled and are no longer counts, and the statistical model that DESeq2 uses assumes count data with a specific mean to variance relationship. Hand DESeq2 the raw count matrix and let it normalize for you.
One-line summary
CPM corrects depth; FPKM and TPM correct depth and length and describe genes within one sample. To compare samples, use DESeq2 or edgeR normalized counts. For differential expression, give DESeq2 or edgeR raw counts and let them normalize internally.
A worked example in R
CPM is the simplest formula. For gene g in a sample, CPM = (count for g / total mapped reads in that sample) × 1,000,000. TPM first divides each count by gene length, then scales so the sample adds up to one million. The example below calculates both by hand, then gives the raw counts to DESeq2 and prints its normalized counts. Look at GENE2 to GENE6: their TPM drops in the treated samples, but their DESeq2 normalized counts stay flat. This code was tested with R 4.3 and DESeq2 1.42.
# A tiny RAW count matrix: 6 genes x 4 samples (2 control, 2 treated)
counts <- matrix(c(
500, 520, 1300, 1250, # HBB: really goes up in treated
200, 210, 60, 55, # GENE2 to GENE6: unchanged biologically,
300, 290, 80, 85, # but squeezed in treated samples because
400, 410, 110, 100, # HBB takes most of the reads
100, 95, 25, 30,
250, 260, 70, 65),
nrow = 6, byrow = TRUE,
dimnames = list(c("HBB", "GENE2", "GENE3", "GENE4", "GENE5", "GENE6"),
c("ctrl1", "ctrl2", "trt1", "trt2")))
storage.mode(counts) <- "integer" # raw counts are whole numbers
gene_length_kb <- c(0.6, 2.0, 1.5, 3.0, 1.0, 2.5)
# --- CPM: corrects depth only ---
cpm <- t(t(counts) / colSums(counts)) * 1e6
round(cpm)
# --- TPM: corrects length first, then depth; each sample sums to 1e6 ---
rpk <- counts / gene_length_kb # reads per kilobase
tpm <- t(t(rpk) / colSums(rpk)) * 1e6
round(tpm)
colSums(tpm) # 1e6 in every sample
# --- DESeq2: give it the RAW counts, it normalizes internally ---
library(DESeq2)
sample_info <- data.frame(condition = factor(c("control", "control",
"treated", "treated")),
row.names = colnames(counts))
dds <- DESeqDataSetFromMatrix(countData = counts,
colData = sample_info,
design = ~ condition)
dds <- estimateSizeFactors(dds) # median-of-ratios
sizeFactors(dds)
round(counts(dds, normalized = TRUE)) # use THESE to compare samples
In the output, GENE2's TPM falls from about 68,000 in the controls to about 12,500 in the treated samples, while its DESeq2 normalized count stays between 104 and 112 in all four. Only HBB truly changed, and only the normalized counts show that.
Check your understanding
Sources & further reading
- Zhao S, Ye Z, Stanton R. Misuse of RPKM or TPM normalization when comparing across samples and sequencing protocols. RNA 26(8): 903-909, 2020. doi:10.1261/rna.074922.120
- Zhao Y, Li M-C, Konaté MM, et al. TPM, FPKM, or normalized counts? A comparative study of quantification measures for the analysis of RNA-seq data from the NCI Patient-Derived Models Repository. Journal of Translational Medicine 19: 269, 2021. doi:10.1186/s12967-021-02936-w
- Wagner GP, Kin K, Lynch VJ. Measurement of mRNA abundance using RNA-seq data: RPKM measure is inconsistent among samples. Theory in Biosciences 131: 281-285, 2012. (Where TPM was proposed.) doi:10.1007/s12064-012-0162-3
- Love MI, Huber W, Anders S. Moderated estimation of fold change and dispersion for RNA-seq data with DESeq2. Genome Biology 15: 550, 2014. doi:10.1186/s13059-014-0550-8
- Robinson MD, Oshlack A. A scaling normalization method for differential expression analysis of RNA-seq data. Genome Biology 11: R25, 2010. (The TMM method used by edgeR.) doi:10.1186/gb-2010-11-3-r25
Last reviewed: October 2026.