ThisCalculator

Math

Log Fold Change Calculator: Formula & How to Use

Updated · Standard formula, shown below

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.

Log Fold Change Calculator: Formula & How to Use

This calculator computes the log2 fold change between two group averages (e.g., control vs. treated) from raw expression values, plus the linear fold change and percent change. Enter the average value for each group and the calculator returns the log2 fold change, which is the standard metric in genomics and bioinformatics for comparing gene expression or other measurements across conditions.

Formula

The log2 fold change is defined as:

log2 fold change = log2(B / A)

where:

  • A = average measurement in the reference group (e.g., control), in whatever units the data uses (counts, concentration, etc.)
  • B = average measurement in the comparison group (e.g., treated), in the same units

The result is expressed in bits (binary digits), but in practice it is just a dimensionless number. A positive value means B is higher than A; a negative value means B is lower.

Worked Example

Using the default values from the calculator: A = 10, B = 40.

  1. Compute the ratio B/A = 40 / 10 = 4.
  2. Take the base-2 logarithm: log2(4) = 2.

The log2 fold change is 2, meaning the treated group has 4 times (2^2) the expression of the control. The linear fold change is 4, and the percent change is (40-10)/10 × 100 = 300%.

Why Use Log2 Fold Change?

Log2 transformation is standard in high-throughput biology (e.g., RNA-seq, microarrays) for several reasons:

  • Symmetric treatment of up- and down-regulation: A doubling gives +1, a halving gives −1, so equal magnitude changes in either direction are numerically equal.
  • Normalizes variance: For many biological measurements, the variability of log-transformed data is more constant across the range of expression levels, which makes statistical tests more valid.
  • Compresses wide ranges: Expression values can span orders of magnitude; log2 makes them manageable and visually interpretable in heatmaps and volcano plots.

Common Mistakes and Pitfalls

  • Using zero or negative values: Log2 of zero is undefined (and negative values give complex results). If your data contains zeros, common practice is to add a small pseudocount (e.g., 1) to all values before log transformation.
  • Confusing the order of groups: log2(B/A) is not the same as log2(A/B). Always define which group is the reference (denominator) before calculating.
  • Rounding too early: Keep full precision until the final step. Rounding the ratio before taking the log can change the result noticeably.
  • Interpreting linear fold change vs. log2: A log2 fold change of 1 means a 2-fold change, not a 1-fold change. The linear fold change is 2^lfc.

How to Choose the Right Method

For most differential expression analyses, log2 fold change is the default. However, consider the context:

  • If your data are already log-transformed, the fold change in linear space is simply the difference of the logs (since log2(B) – log2(A) = log2(B/A)).
  • For ratios that are naturally multiplicative (e.g., dilution series), log2 is preferred.
  • For additive changes (e.g., absolute concentration differences), a simple difference might be more meaningful, but that is uncommon in genomics.
  • When reporting to a non-technical audience, linear fold change (e.g., “4-fold increaseâ€�) is often clearer.

Limitations of the Simple Fold Change

The simple fold change ignores variability within groups. A gene with average expression 10 in control and 20 in treated has the same fold change as one going from 100 to 200, but the latter may be more statistically reliable. In practice, researchers use statistical tests (e.g., t-test, DESeq2, edgeR) that incorporate variance and sample size. Fold change alone should not be used to call differentially expressed genes; it is usually combined with a p-value or adjusted p-value threshold.

Frequently Asked Questions

What is a good log2 fold change cutoff?

There is no universal cutoff. Many studies use |log2 fold change| ≥ 1 (i.e., at least a 2-fold change) as a starting filter, but the appropriate threshold depends on the biological question and the magnitude of effects you expect. Some analyses use 0.5 or 1.5. Always justify the cutoff in the context of your experiment.

How do I calculate log2 fold change from raw counts?

First, normalize the counts (e.g., TPM, FPKM, or DESeq2’s median-of-ratios). Then take the average normalized value for each group (or use the mean of the log-transformed values). Finally, compute log2(B/A) as shown above. If any value is zero, add a pseudocount (e.g., 1) to all values before taking logs.

What does a log2 fold change of -3 mean?

A log2 fold change of -3 means the expression in group B is 2^-3 = 1/8 times that in group A, i.e., an 8-fold decrease. The negative sign indicates down-regulation relative to the reference group.

Can I use log10 instead of log2?

Yes, but log2 is conventional in genomics because each unit corresponds to a doubling. If you use log10, a change of 1 means a 10-fold change, which is less intuitive for small differences. You can convert: log2(x) = log10(x) / log10(2).

What if my data are already in log2 scale?

If your values are already log2-transformed, the log2 fold change is simply the difference between the group means: mean(log2(B)) – mean(log2(A)). You do not need to take the log again.

Related

Formula used
in a | Group A average | - | 10 | 0
in b | Group B average | - | 40 | 0
out lfc | Log2 fold change (B/A) | log2(b/a) | 2
out fc | Fold change (B/A) | b/a | 2
out pct | Percent change | (b-a)/a*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.