What Is a Logarithm?
A logarithm answers the question: to what power must a base be raised to produce a given number? If 10^2 = 100, then log base 10 of 100 = 2. The logarithm and the exponent are inverse operations, just as division undoes multiplication. For computing powers directly, use our Exponent Calculator.
Logarithms compress large ranges of numbers into manageable scales. The Richter scale for earthquakes, the decibel scale for sound, and the pH scale for acidity all use logarithms. They also appear throughout calculus, statistics, information theory, and algorithm analysis. John Napier introduced logarithms in 1614 as a calculation tool, and they revolutionized astronomy and navigation by simplifying complex multiplications into additions.
What This Calculator Does
This calculator computes logarithms in any base, including the most common bases (10, e, and 2). It also calculates antilogarithms, which reverse the log operation by computing the base raised to a given power. Results for all three common bases are shown simultaneously for easy comparison.
- Inputs: A positive number, a base (preset or custom), and a choice of log or antilog mode
- Outputs: The logarithm result for the chosen base, plus log base 10, ln, and log base 2 for reference
How the Calculation Works
The Logarithm Definition
log_b(x) = y means b^y = x
If b is the base and x is the number, the logarithm y is the exponent that makes b^y equal x. For any base b, you can compute log_b(x) using natural log: log_b(x) = ln(x) / ln(b). This change-of-base formula is how calculators and software handle arbitrary bases.
Common Logarithm (log base 10)
Base 10 is the most familiar. log base 10 of 1000 = 3 because 10^3 = 1000. Written simply as "log" without a base in most scientific contexts, it is used in pH calculations, the Richter scale, and decibel measurements.
Natural Logarithm (ln)
The natural log uses the mathematical constant e, approximately 2.71828, as its base. ln(x) appears naturally in calculus, exponential growth models, probability theory, and finance. The derivative of ln(x) is 1/x, which makes it especially useful in integration.
Binary Logarithm (log base 2)
Base 2 is the foundation of computer science. log base 2 of n tells you how many bits are needed to represent n states. It appears in the analysis of algorithms, data compression, and information theory. For working with binary numbers directly, see our Binary Calculator.
How to Use the Calculator
- Select Logarithm mode to compute log_b(x), or Antilogarithm to compute b^y
- Choose a preset base (log base 10, ln, log base 2) or enter a custom base
- Enter the number you want to take the log of (must be greater than zero)
- The result appears instantly, along with results for all three common bases
- For antilog mode, enter the exponent and read b^y directly
Example Calculations
Example 1: Common Log
log base 10 of 1000 = 3, because 10^3 = 1000. log base 10 of 0.01 = -2, because 10^(-2) = 0.01. Negative log values mean the input is between 0 and 1.
Example 2: Natural Log
ln(e) = 1. ln(1) = 0, because e^0 = 1. ln(7.389) is approximately 2, because e^2 is approximately 7.389. The natural log grows slowly, which is why it models gradual processes like compound interest decay.
Example 3: Custom Base
log base 5 of 125 = 3, because 5^3 = 125. Enter 5 as the base and 125 as the number to verify this. The change-of-base formula confirms: ln(125) / ln(5) = 4.828 / 1.609, which is approximately 3.
Real-World Scenarios
Sound and Decibels
Elena, an audio engineer in Nashville, needs to calculate the intensity ratio between two sounds. Sound intensity is measured in decibels using the formula dB = 10 x log base 10 of (I / I0). A 10 dB increase represents a 10-fold increase in intensity. A sound at 80 dB is 10 times as intense as one at 70 dB, even though the numbers appear to differ by only 10. Elena uses this calculator to convert between decibel readings and actual intensity ratios when calibrating studio monitors.
Finance and Continuous Compounding
Marcus, a quantitative analyst in Chicago, uses natural logarithms to calculate the time required for an investment to double at a given continuous compounding rate. The formula is t = ln(2) / r, which is approximately 0.693 / r. At a 5% continuous rate, the doubling time is 0.693 / 0.05 = 13.86 years. This is the continuous version of the Rule of 72. Natural log also appears in options pricing models like Black-Scholes and in bond yield calculations. For related calculations, see our Interest Rate Calculator.
Computer Science and Algorithm Complexity
Priya, a software developer in Bangalore, is analyzing the performance of a binary search algorithm. Binary search has O(log base 2 of n) complexity. Searching 1,024 items requires at most log base 2 of 1024 = 10 comparisons. Searching 1,048,576 items (2^20) requires only 20 comparisons. She uses this calculator to estimate how algorithms scale with input size. For very large numbers in algorithm analysis, our Scientific Notation Calculator is also useful.
pH and Chemistry
The pH scale measures acidity using the formula pH = -log base 10 of [H+], where [H+] is the hydrogen ion concentration in moles per liter. Pure water has a pH of 7, meaning [H+] = 10^(-7). A solution with pH 3 is 10,000 times more acidic than pure water. This logarithmic scale allows chemists to express enormous concentration ranges in a compact 0 to 14 scale. For radioactive decay calculations that also use logarithms, see our Half-Life Calculator.
Common Mistakes to Avoid
- Taking the log of zero or a negative number: Logarithms are only defined for positive numbers. log(0) is negative infinity and log of a negative number is not a real number
- Confusing log and ln: In many textbooks and calculators, "log" without a base means log base 10. In mathematics and programming, "log" sometimes means natural log. Always check which convention is being used
- Using base 1: A base of 1 is not valid because 1 raised to any power always equals 1, making the logarithm undefined
- Misapplying log rules: log(a + b) does not equal log(a) + log(b). The product rule says log(a x b) = log(a) + log(b), not addition inside the log
- Forgetting that log of 1 is always 0: Regardless of the base, log_b(1) = 0 because any base raised to the power 0 equals 1. This is a useful sanity check when verifying results
Limitations of This Calculator
This calculator computes real-valued logarithms for positive numbers only. It does not handle complex logarithms, which involve imaginary numbers and multi-valued functions. Results are computed using double-precision floating-point arithmetic, which means very large or very small inputs may lose precision. The change-of-base formula introduces small rounding errors for custom bases. For applications requiring arbitrary-precision logarithms, such as cryptographic calculations or number theory research, a specialized tool like Mathematica, Maple, or the Python mpmath library is more appropriate.
Authoritative Research & Resources
- Wolfram MathWorld - Logarithm - The definitive mathematical reference for logarithms, maintained by Wolfram Research. Covers the formal definition, properties, historical development, and applications across mathematics and science. Suitable for students, educators, and researchers.
- Khan Academy - Introduction to Logarithms - Free educational resource with video lessons and practice problems covering logarithm basics, properties, and applications. Ideal for students learning logarithms for the first time or reviewing for standardized tests.
- NIST - SI Units and Logarithmic Scales - The National Institute of Standards and Technology provides official guidance on measurement scales, including the decibel scale for sound and the pH scale for acidity, both of which rely on logarithms.