Log Transformation Calculator

StatisticsLast updated: August 22, 2026

A logarithmic transformation is a non-linear transformation that shrinks large values disproportionately and pulls a right-skewed distribution toward symmetry. For variables that grow multiplicatively — income, company revenue, illness duration, reaction time, website traffic — it is an almost standard preprocessing step, because for those variables equal ratios carry more meaning than equal differences.

This calculator does not just apply the transformation; it tells you with numbers whether it worked. It computes skewness and kurtosis separately before and after, reports the drop in absolute skewness as a percentage, and runs the Shapiro-Wilk normality test on both series. When the data contains zeros or negative values, where ln and log₁₀ are undefined, it steers you to the log(x + 1) option, and the before-and-after histograms and Q-Q plots let you confirm the result visually as well.

You can separate the numbers with commas, spaces, or line breaks. A decimal comma is also accepted (3,14).
ln and log₁₀ are defined only for positive values; if your data contains 0, use one of the +1 shifted options.

Logarithmic Transformation Formulas

Natural logarithm:  y = ln(x),      x > 0     inverse: x = eʸ
Base 10:            y = log₁₀(x),  x > 0     inverse: x = 10ʸ
Data with zeros:    y = ln(x + 1), x > −1    inverse: x = eʸ − 1
General shift:      y = ln(x + c), c > −min(x)
Base relationship:  log₁₀(x) = ln(x) / ln(10) = ln(x) / 2.302585
Skewness:           g₁ = [n / ((n−1)(n−2))] · Σ((yᵢ − ȳ) / s_y)³
Geometric mean:     GM = exp(ȳ) = ⁿ√(x₁·x₂·…·xₙ)

The success of the transformation is measured by whether |g₁| gets smaller afterwards. A value of |g₁| < 0.5 counts as approximate symmetry and |g₁| > 1 as marked skewness. A logarithm only helps with right-skewed data (g₁ > 0).

How to Calculate

  1. Paste the values you want to transform into the box; at least 5 observations are required, because skewness and kurtosis are not reliable in smaller samples.
  2. Choose the transformation type: ln if you will interpret the result as an elasticity, log₁₀ if you will read it as fold growth.
  3. If your data contains zeros, switch to ln(x + 1) or log₁₀(x + 1); the plain logarithm is undefined at zero.
  4. Compare the before and after values of the skewness in the results panel; the 'Verdict on the transformation' row states outright whether it helped.
  5. Check the Shapiro-Wilk p-values: a p-value that rises above 0.05 after the transformation means normality is no longer rejected.
  6. Inspect the before-and-after histograms together with the Q-Q plots to confirm the numerical result visually.

Worked Examples

Right-skewed income data

The skewness of the 12 income values is 2.026; after the ln transformation it drops to 0.242, so the absolute skewness falls by 88.1% and the distribution becomes approximately symmetric. Kurtosis drops from 4.679 to −0.013, and while the Shapiro-Wilk test rejects normality before the transformation with p = 0.008, it does not reject it afterwards.

Sample size (n): 12 · Transformation applied: y = ln(x) · Skewness — before the transformation: 2.026

Count data containing zeros

Because the data contains zeros, ln(x) is undefined; with ln(x + 1) the skewness falls from 2.062 to 0.308, a reduction of 85.0% in absolute skewness. The Shapiro-Wilk p-value rises from 0.002 to 0.812, so normality is no longer rejected.

Sample size (n): 12 · Transformation applied: y = ln(x + 1) · Skewness — before the transformation: 2.062

A case where the log transformation does not help

On a left-skewed series of scores, the log₁₀ transformation moves the skewness from −0.534 to −0.620; instead of falling, the absolute skewness rises by 16.1% and the calculator reports the outcome as 'The transformation did not help'. The warning line points to a square or cube transformation for left-skewed data.

Sample size (n): 12 · Transformation applied: y = log₁₀(x) · Skewness — before the transformation: -0.534

Frequently Asked Questions

When should a logarithmic transformation be used?
Use it when the variable is right-skewed (a few very large values), when the variance grows along with the mean, or when the relationships are multiplicative rather than additive. Income, revenue, prices, reaction times, microbial counts, and population figures are typical candidates. It should not be applied to left-skewed or already symmetric data; it makes matters worse.
What should I do if my data contains zeros or negative values?
A logarithm is defined only for positive numbers, so you first have to move the series into positive territory. The most common solution is the ln(x + 1) transformation, which maps zero to zero and barely distorts small values. If there are negative values, a constant larger than |min(x)| is added, but since the chosen constant affects the result it must be stated in the report. Alternatively, the inverse hyperbolic sine (asinh) transformation also works with negative values.
Should I choose ln or log₁₀?
Statistically it makes no difference: the two transformations are related by a constant factor, so skewness, kurtosis, correlations, and normality tests come out exactly the same. The choice comes down to interpretive convenience: on the ln scale small coefficients are read directly as percentage changes, whereas on the log₁₀ scale an increase of 1 unit means tenfold growth, which keeps plots readable over wide ranges.
How should I report results after a transformation?
The clearest route is to run the analysis on the transformed scale and convert the results back to the raw unit for reporting. Note, however, that inverting a mean on the ln scale gives the geometric rather than the arithmetic mean, so use the phrase 'geometric mean' explicitly. The endpoints of a confidence interval can also be back-transformed, but the resulting interval will not be symmetric on the raw scale.
How much skewness calls for a transformation?
The common criterion is |g₁| > 1: at that level the skewness visibly affects the performance of parametric tests. For mild skewness between 0.5 and 1, especially with a large n, the central limit theorem usually makes a transformation unnecessary. The decision depends not only on the number but on the type of analysis; tests comparing means are more robust to skewness than variance analyses.
How do you apply a logarithmic transformation in SPSS, Excel, and R?
In SPSS, write LN(variable) or LG10(variable) in the Transform > Compute Variable window. In Excel, use =LN(A2) and =LOG10(A2), or =LN(A2+1) for data containing zeros. In R, log(x), log10(x), and log1p(x) do the same job; log1p is numerically more stable for small values.
What can I do instead of transforming?
Non-parametric tests (Mann-Whitney U, Kruskal-Wallis) need no transformation on skewed data. Generalized linear models can model skewed distributions directly: Poisson or negative binomial for count data, gamma regression for positive continuous data. Robust standard errors and bootstrapping also give valid inference without resorting to a transformation.