Log calculator
Enter a number and a base, get the logarithm instantly.
What is a logarithm?
The exponent you need: log_b(x) is the power you raise b to in order to get x. log₁₀(1,000) = 3 because 10³ = 1,000, and log₂(8) = 3 because 2³ = 8.
What is the difference between log and ln?
"log" usually means base 10 (the common logarithm) and "ln" means base e ≈ 2.71828 (the natural logarithm). ln(10) ≈ 2.302585, and ln(e) = 1.
How do I change the base of a logarithm?
Divide two logs with the same base: log_b(x) = ln(x) ÷ ln(b). For example, log₃(81) = ln 81 ÷ ln 3 = 4.3944 ÷ 1.0986 = 4.
Can I take the log of 0 or a negative number?
No — no power of a positive base gives 0 or a negative number, so log(0) and log(−5) are undefined for real numbers. The base must also be positive and not 1.
Where are logarithms used?
In scales that span huge ranges: decibels, the pH scale and earthquake magnitudes are all base-10 logs, and ln shows up in compound interest and growth and decay problems.
What are the rules of logarithms?
Product: log(MN) = log M + log N. Quotient: log(M ÷ N) = log M − log N. Power: log(Mⁿ) = n × log M. They hold in any base, as long as both sides are defined.
How do I solve an equation like 1.05^t = 2?
Take the log of both sides and use the power rule: t × ln 1.05 = ln 2, so t = ln 2 ÷ ln 1.05 = 14.2. The calculator does this directly when you enter 2 with base 1.05.
What is the antilogarithm?
The inverse: if log₁₀(x) = 2.5, then x = 10^2.5 = 316.2. The exponent calculator on this site raises a base to a power.
Using the properties
The product rule turns multiplication into addition, which is why logarithms were once used for hand calculation. log₁₀ 2 + log₁₀ 500 = 3, the same as log₁₀ 1,000, because 2 × 500 = 1,000. The power rule moves an exponent to the front, and the change-of-base formula log_b(x) = ln x ÷ ln b lets any calculator with an ln key handle any base. The domain is limited: x must be positive, and the base must be positive and not 1.
Worked example: doublings and doubling time
How many times must 1 be doubled to pass 1,000? That is log₂ 1,000 = 9.9658, so 10 doublings, because 2⁹ = 512 falls short and 2¹⁰ = 1,024 passes. For growth at 5% a year, money doubles when 1.05^t = 2, so t = ln 2 ÷ ln 1.05 = 14.21 years.
Mistakes to avoid
The log of a sum is not the sum of the logs. log₁₀(100 + 1,000) = 3.0414, while log₁₀ 100 + log₁₀ 1,000 = 5; the product rule applies to products only. Another trap is the meaning of "log": calculators and textbooks usually mean base 10, but many programming languages (JavaScript, Python) use log for the natural logarithm, so check before comparing results. Finally, round only at the end; rounding ln values to a few digits before dividing can change the answer.
Logarithms of numbers below 1
The log of a number between 0 and 1 is negative, because you need a negative exponent to shrink 1. log₁₀ 0.001 = -3 since 10⁻³ = 0.001, and log₂ 0.5 = -1. The log of 1 is 0 in every base, because any base raised to the power 0 is 1. As x gets closer to 0 the log falls without limit, which is why log 0 does not exist.
Logarithms in science: pH and decibels
A logarithmic scale turns multiplication into steps of equal size. The pH of a solution is −log₁₀ of its hydrogen-ion concentration in moles per liter, so a concentration of 3.2 × 10⁻⁴ gives pH = 3.49, and each drop of one pH unit means ten times the concentration. In acoustics and electronics, a power ratio in decibels is 10 × log₁₀ (ratio): doubling the power adds 10 × log₁₀ 2 = 3.01 dB, and a hundredfold increase adds 20 dB. These scales are why a calculator that gives log₁₀ is so useful outside math class; the dedicated pH and decibel calculators on this site apply the same formulas.
Counting digits with a logarithm
The number of digits of a positive integer n is ⌊log₁₀ n⌋ + 1. For 2¹⁰⁰ you do not need to write the number out: log₁₀ 2¹⁰⁰ = 100 × log₁₀ 2 = 30.103, so 2¹⁰⁰ has 31 digits and begins with 10^0.103, about 1.27. The same power rule is how scientific notation, orders of magnitude and the idea that "log tells you the size" fit together.
Sources: OpenStax, College Algebra 2e, section 6.5 "Logarithmic Properties" (product, quotient, power rules, change of base). Related tools: exponent calculator, scientific calculator, decibel calculator, pH calculator, compound interest calculator.