Logarithm Calculator

Calculate logarithms in any base (log, ln, log2) with step-by-step working. Includes antilog mode and a properties reference card.

This calculator computes logarithms in any base with full step-by-step working. It supports common log (base 10), natural log (base e), binary log (base 2), and any custom base you enter. An antilog mode reverses the calculation, and a built-in properties reference card covers the rules you need for algebra and exam prep.

Ad
Ad

About Logarithm Calculator

What Is a Logarithm?

A logarithm answers a single question: what power must I raise the base to in order to get a given number? The formal definition is:

log_b(x) = y means b^y = x

Scottish mathematician John Napier published the first logarithm tables in 1614 in his work Mirifici Logarithmorum Canonis Descriptio. Before electronic calculators existed, log tables turned multiplication and division into simple addition and subtraction, because log(a * b) = log(a) + log(b). Napier spent 20 years developing the concept, and it was adopted almost immediately by astronomers and navigators who needed to perform large multiplications daily.

Basic examples:

  • log₁₀(100) = 2 because 10² = 100
  • log₂(8) = 3 because 2³ = 8
  • ln(e) = 1 because e¹ = e
  • log₁₀(0.01) = -2 because 10⁻² = 0.01
  • log₃(81) = 4 because 3⁴ = 81

The Three Common Bases

Most practical logarithm work uses one of three bases. The table below shows where each one appears.

NameNotationBasePrimary uses
Common loglog(x) or log₁₀(x)10pH scale, decibels, Richter scale, order-of-magnitude estimates
Natural logln(x) or logₑ(x)e (approx 2.71828)Calculus, continuous growth and decay, physics, statistics
Binary loglog₂(x)2Computer science, information theory, algorithm complexity

The natural log base e is an irrational constant (2.71828...) that arises naturally in calculus when modelling continuous processes. Leonhard Euler popularised the notation ln(x) in the 18th century. The binary log is central to computer science because digital systems operate in base 2 - every bit doubles the number of possible states.

How the Change of Base Formula Works

Most calculators only have buttons for log₁₀ and ln. To compute a log in any other base, use the change-of-base formula:

log_b(x) = ln(x) / ln(b)

Worked example - log₅(125):

  1. Compute ln(125) = 4.8283
  2. Compute ln(5) = 1.6094
  3. Divide: 4.8283 / 1.6094 = 3
  4. Verify: 5³ = 125. Correct.

This works because the formula is a direct consequence of the power rule and the definition of logarithms. The base you use for the numerator and denominator does not matter - you could equally use log₁₀(x) / log₁₀(b) and get the same answer.

Second worked example - log₇(2401):

  1. ln(2401) = 7.7832
  2. ln(7) = 1.9459
  3. 7.7832 / 1.9459 = 4
  4. Verify: 7⁴ = 2,401. Correct.

Logarithm Properties

These rules are the foundation for simplifying and solving logarithmic expressions in algebra and calculus.

PropertyRuleExample
Product rulelog(ab) = log(a) + log(b)log(6) = log(2) + log(3) = 0.301 + 0.477 = 0.778
Quotient rulelog(a/b) = log(a) - log(b)log(5) = log(10) - log(2) = 1 - 0.301 = 0.699
Power rulelog(a^n) = n * log(a)log(8) = log(2³) = 3 * log(2) = 3 * 0.301 = 0.903
Change of baselog_b(x) = ln(x) / ln(b)log₅(25) = ln(25) / ln(5) = 3.219 / 1.609 = 2
Log of 1log_b(1) = 0Any base: b⁰ = 1, so log(1) = 0
Log of the baselog_b(b) = 1log₁₀(10) = 1, ln(e) = 1, log₂(2) = 1
Inverse ruleb^(log_b(x)) = x10^(log₁₀(50)) = 50

A common mistake is writing log(a + b) = log(a) + log(b). This is wrong. The product rule applies to multiplication inside the log, not addition. There is no simple rule for log(a + b).

Where Logarithms Appear in Real Life

Logarithmic scales are used whenever a quantity spans many orders of magnitude and human perception responds proportionally to ratios rather than absolute differences.

ScaleBaseHow it works
Richter scale (earthquakes)10Each whole number increase represents a 10x increase in seismograph amplitude and roughly 31.6x more energy released. A magnitude 7 earthquake releases about 31.6 times the energy of a magnitude 6, according to the USGS.
Decibels (sound)10dB = 10 * log₁₀(I/I₀). Every +10 dB means 10x the sound intensity. Normal conversation is about 60 dB; a rock concert can exceed 120 dB, which is a trillion times the intensity of the threshold of hearing.
pH (chemistry)10pH = -log₁₀[H⁺]. Each pH unit represents a 10x change in hydrogen ion concentration. Pure water has pH 7; stomach acid has pH around 1.5 - roughly 300,000 times more acidic.
Musical intervals2Frequency doubles every 12 semitones (one octave). A4 = 440 Hz, A5 = 880 Hz. The number of octaves between two frequencies is log₂(f₂/f₁).
Algorithm complexity2Binary search runs in O(log₂ n) time. Searching a sorted list of 1 billion items takes at most 30 comparisons (log₂(10⁹) = 29.9).
Compound interesteTime to reach a target balance = ln(target/start) / rate. To double money at 5% annual interest: t = ln(2) / 0.05 = 13.86 years.
Stellar brightness10^(2/5)Each magnitude step is 10^(2/5) = 2.512x brighter. A magnitude 1 star is 100x brighter than magnitude 6.

The Antilog (Inverse Logarithm)

The antilog reverses a logarithm. If log₁₀(x) = 2, then antilog₁₀(2) = 10² = 100. The formula is:

antilog_b(y) = b^y

Worked example - converting pH to concentration:

A solution has pH 4.3. What is the hydrogen ion concentration?

  1. [H⁺] = 10^(-pH) = 10^(-4.3)
  2. = 10^(-4) * 10^(-0.3)
  3. = 0.0001 * 0.5012
  4. = 5.012 * 10⁻⁵ mol/L

Other practical antilog uses include converting decibels back to intensity ratios (ratio = 10^(dB/10)), converting Richter magnitude to energy release, and recovering original values from log-transformed data in statistics. For working with exponents directly, the exponent calculator handles any base raised to any power.

Common Log Values Worth Memorising

Knowing a few key values lets you estimate logarithms quickly without a calculator.

xlog₁₀(x)ln(x)log₂(x)
1000
20.3010.6931
e (2.718)0.43411.443
50.6991.6092.322
1012.3033.322
10024.6056.644
1,00036.9089.966

A handy trick: since log₁₀(2) = 0.301, you can estimate log₁₀(2^n) = n * 0.301. For example, log₁₀(1024) = log₁₀(2¹⁰) = 10 * 0.301 = 3.01, which matches 1024 being just over 1,000.

How to Solve Logarithmic Equations

Logarithmic equations appear in algebra, pre-calculus, and real-world problems like radioactive decay and population growth. The basic strategy is to isolate the logarithm, then convert to exponential form.

Example 1 - Solve log₂(x) = 5:

  1. Convert to exponential form: x = 2⁵
  2. x = 32

Example 2 - Solve log₃(x - 2) + log₃(x) = 1:

  1. Apply the product rule: log₃(x(x - 2)) = 1
  2. Convert to exponential form: x(x - 2) = 3¹ = 3
  3. Expand: x² - 2x - 3 = 0
  4. Factor: (x - 3)(x + 1) = 0, so x = 3 or x = -1
  5. Check domain: x must be positive and x - 2 must be positive, so x > 2. Only x = 3 is valid.

Always check that your solution falls within the domain of the original equation. Logarithms of negative numbers and zero are undefined in real arithmetic, so extraneous solutions often appear when solving.

Logarithmic vs Exponential Growth

Logarithmic and exponential functions are inverses of each other. If y = b^x is the exponential function, then x = log_b(y) is the logarithmic function. This inverse relationship is important in several contexts:

  • Radioactive decay: The half-life formula uses natural logs. If a substance decays to a fraction f of its original amount, the time elapsed is t = -ln(f) / decay_constant. For example, Carbon-14 has a half-life of 5,730 years: t = -ln(0.5) / (0.693 / 5730) = 5,730 years.
  • Population doubling: If a population grows at rate r per year, it doubles in t = ln(2) / r years. At 3% annual growth, doubling time = 0.693 / 0.03 = 23.1 years.
  • Cooling and heating: Newton's law of cooling uses ln to solve for time. The temperature difference decays exponentially, so finding when an object reaches a target temperature requires taking a natural log.

Common Mistakes When Working With Logarithms

These errors come up repeatedly in algebra courses and standardised exams:

  • log(a + b) is not log(a) + log(b). The product rule only applies when the values inside the log are multiplied, not added.
  • log(a * b) is not log(a) * log(b). Multiplication inside the log becomes addition outside: log(a) + log(b).
  • Forgetting the domain restriction. log_b(x) is only defined for x > 0 and b > 0, b != 1. Entering 0 or a negative number is undefined in real numbers.
  • Confusing ln and log. In mathematics and most calculators, "log" means base 10 and "ln" means base e. In some programming languages (Python, JavaScript), Math.log() returns the natural log, not base 10.
  • Dropping the base. Writing "log(x) = 3" is ambiguous without specifying the base. Always state which base you mean.
  • Extraneous solutions. When solving log equations, always substitute your answer back into the original equation to verify it is valid. Squaring or applying the product rule can introduce solutions outside the domain.

Logarithms in Programming Languages

When implementing logarithms in code, be aware that function names vary across languages:

LanguageNatural log (base e)Common log (base 10)Binary log (base 2)
JavaScriptMath.log(x)Math.log10(x)Math.log2(x)
Pythonmath.log(x)math.log10(x)math.log2(x)
C / C++log(x)log10(x)log2(x)
JavaMath.log(x)Math.log10(x)Math.log(x)/Math.log(2)
Excel / SheetsLN(x)LOG10(x)LOG(x, 2)

Notice that Math.log() in JavaScript and Python returns the natural log, not base 10. This trips up many developers who expect "log" to mean base 10.

For solving equations that involve logarithms (like 2^x = 64), the equation solver handles step-by-step algebra. To plot logarithmic functions and see their curves, the graphing calculator can graph y = log(x), y = ln(x), or any custom function. For precision work with significant figures, the sig figs calculator rounds results correctly.

Sources

Frequently Asked Questions

What bases are supported?

You can use any positive base except 1. Quick buttons are provided for base 10 (common log), base e (natural log), and base 2 (binary log). For any other base, just type it in.

What is antilog?

Antilog is the reverse of a logarithm. If log base 10 of 100 is 2, then antilog base 10 of 2 is 100. It is the same as computing base raised to the power of the log value.

Why is log of 0 undefined?

There is no power you can raise a positive base to and get 0. For example, 10 raised to any real number is always positive. So log(0) has no answer in the real numbers.

What is the change of base formula?

To convert between bases, use log_b(x) = ln(x) / ln(b). This lets you compute a log in any base using only natural logarithms, which is how most calculators work internally.

Can I use this for natural logarithms?

Yes. Click the ln(e) quick base button or enter 2.71828 as the base. The tool shows the natural log alongside log base 10 and log base 2 for easy comparison.

Link to this tool

Copy this HTML to link to this tool from your website or blog.

<a href="https://toolboxkit.io/tools/log-calculator/" title="Logarithm Calculator - Free Online Tool">Try Logarithm Calculator on ToolboxKit.io</a>