Log2 Fold Change Calculator: Formula & Examples
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
This calculator works out the log2 fold change between two groups (e.g., treated vs. control), a value commonly used in genomics and biology to show how much a gene’s expression changes. You enter the average expression value for the control group and the average for the treated group, and the calculator returns the log2 fold change, plus the raw fold change and the percent change. A log2 fold change of 1 means the treated group is double the control; -1 means it is half.
Formula
The log2 fold change is the logarithm (base 2) of the ratio of the treated value to the control value:
log2FC = log2(T / C)
Where:
- T = average expression (or measurement) in the treated group, in whatever units your data uses.
- C = average expression in the control group, same units.
- log2 = logarithm base 2 (i.e., the exponent you raise 2 to in order to get T/C).
The raw fold change is simply T / C. The log2 transformation makes the scale symmetric: a doubling gives +1, a halving gives -1, which is why it is preferred in bioinformatics for plotting and ranking genes.
Worked Example
Using the default values from the calculator: Control average = 10, Treated average = 20.
- Compute the ratio: T / C = 20 / 10 = 2.
- Take log base 2: log2(2) = 1.
- So the log2 fold change = 1.00.
- Raw fold change = 2 (treated is twice control).
- Percent change = (2 – 1) × 100 = 100% increase.
If the treated average were 5 instead, the ratio would be 0.5, log2(0.5) = -1, and the percent change would be -50%.
When to Use Log2 Fold Change
Log2 fold change is the standard metric in differential expression analysis (e.g., RNA-seq, microarray, proteomics) because it treats up- and down-regulation symmetrically. A gene that doubles (log2FC = 1) and one that halves (log2FC = -1) are equally distant from zero, which is not true for raw fold change (2 vs. 0.5). It also compresses the range: a 1000-fold increase becomes 9.97, while a 1000-fold decrease becomes -9.97, making data easier to visualize and compare across genes.
Use it whenever you need to rank genes by magnitude of change, especially when you plan to apply a threshold (e.g., |log2FC| > 1 and adjusted p-value < 0.05). It is also the natural input for volcano plots, where the x-axis is log2FC and the y-axis is -log10(p-value).
How to Choose Control and Treated Values
The values you enter should be the average expression across replicates, not individual samples. Typically, you compute the mean of normalized counts (e.g., CPM, TPM, or DESeq2’s baseMean) for each group. If you have only one sample per group, the calculator still works, but the result is less reliable because no variance is accounted for. Always use the same normalization method for both groups; mixing raw counts and normalized values will give a misleading fold change.
Common Mistakes and Misconceptions
- Using raw counts without normalization: Library size differences between samples will inflate or deflate the fold change. Normalize first.
- Log of zero or negative values: If either average is 0, the ratio is undefined or infinite. Many pipelines add a small pseudocount (e.g., 1) to all values before taking logs. This calculator will return an error for zero; add a small constant to both groups if needed.
- Confusing log2 fold change with fold change: A log2FC of 2 is a 4-fold increase, not a 2-fold increase. Always check which scale you are looking at.
- Ignoring statistical significance: A large fold change can be noise if the variance is high. Fold change alone is not evidence of a real difference; combine it with a p-value or confidence interval.
- Rounding too early: Round only the final answer, not intermediate steps, to avoid accumulated error.
Limitations of the Simple Ratio
This calculator gives the point estimate of the fold change, but it does not tell you whether that change is statistically significant. In real experiments, you need replicates, a statistical test (e.g., t-test, DESeq2, edgeR), and multiple-testing correction. Also, the fold change is sensitive to outliers: a single extreme sample can skew the mean. For noisy data, consider using the median or a robust estimator. Finally, the log2 transform assumes the ratio is positive; if your data can be negative (e.g., after background subtraction), the log2 is not defined, and you should use a different metric.
Frequently Asked Questions
What is a good log2 fold change threshold?
There is no universal cutoff. In many RNA-seq studies, researchers use |log2FC| ≥ 1 (i.e., at least a 2-fold change) combined with an adjusted p-value < 0.05. However, the appropriate threshold depends on your experiment, the biological context, and how many genes you expect to change. Some studies use 0.58 (1.5-fold) or 2 (4-fold) for more stringent filtering.
Why use log2 instead of log10?
Log2 is preferred because a change of 1 unit corresponds to a doubling or halving, which is easy to interpret. Log10 would make a 10-fold change equal to 1, which is less intuitive for small changes. Both are mathematically valid; log2 is simply the convention in genomics.
How do I convert log2 fold change back to fold change?
Raise 2 to the power of the log2FC. For example, if log2FC = 1.5, then fold change = 2^1.5 ≈ 2.83. If log2FC = -0.5, then fold change = 2^-0.5 ≈ 0.707 (i.e., about 29% decrease).
Can I use this calculator for protein expression or other data?
Yes, the math is the same for any paired measurements—proteomics, metabolite levels, or even non-biological data. The only requirement is that both values are positive and on the same scale. The interpretation of “treated� and “control� is up to you.
What if my control average is zero?
The ratio is undefined (division by zero). In practice, you should add a small pseudocount (e.g., 1) to all values before computing the log2 fold change. This is common in bioinformatics pipelines. The calculator will show an error; add a constant to both inputs and try again.
Is log2 fold change the same as log2(expression ratio)?
Yes, it is exactly the same. The expression ratio is T/C, and the log2 of that ratio is the log2 fold change. Some people write it as log2(T) – log2(C), which is mathematically identical due to logarithm rules.
Related
Formula used
in ctrl | Control average | - | 10 | 0 in trt | Treated average | - | 20 | 0 out log2fc | Log2 fold change | log2(trt/ctrl) | 2 out fold | Fold change | trt/ctrl | 2 out pct | Percent change | % | (trt/ctrl - 1) * 100 | 1
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.