Logarithm Calculator — Custom Base, Natural Log, Common Log &
Calculate logarithms in any custom base with the change of base formula explained step-by-step. Free, instant, and accurate.
See it worked out
Example — Base (b) 2, Number (x) 8:
log_2(8)
3
Exponential Form
2^3 = 8
log₁₀(x)
0.903089987
ln(x)
2.079441542
log₂(x)
3
Change of Base
log_2(8) = log₁₀(8) / log₁₀(2) = 0.903089987 / 0.3010299957 = 3
The formula
log_b(x) = y ↔ b^y = x | log_b(x) = log₁₀(x) / log₁₀(b)
- b
- Base
- x
- Argument
- y
- Result
Worked example — Base (b) 2, Number (x) 8
log_2(8) = 3
How Log Calculator Works
log_b(x) = y ↔ b^y = x | log_b(x) = log₁₀(x) / log₁₀(b)
A logarithm answers the question: "to what exponent must the base be raised to produce this number?" The change of base formula allows calculating logarithms in any base using the log10 or ln buttons found on standard calculators.
- b
- Base — The base of the logarithm. Must be positive and not equal to 1. Common bases: 10 (common log), e (natural log), 2 (binary log).
- x
- Argument — The number whose logarithm is being taken. Must be positive. The log of a number between 0 and 1 is negative.
- y
- Result — The exponent such that b^y = x. For example, log2(8) = 3 because 2^3 = 8.
How to Use
- Enter the base of the logarithm (must be > 0, and cannot be 1).
- Enter the number to take the log of (must be > 0).
- View the logarithm result for your custom base.
- The calculator also shows common (log10), natural (ln), and binary (log2) logs of the same number for comparison.
- The change of base formula shows step-by-step how the result was computed using base-10 logs.
Quick Reference
| log10(1) | 0 (10^0 = 1) |
| log10(10) | 1 (10^1 = 10) |
| log10(100) | 2 (10^2 = 100) |
| ln(1) | 0 (e^0 = 1) |
| ln(e) | 1 (e^1 = e) |
| log2(1) | 0 (2^0 = 1) |
| log2(1024) | 10 (2^10 = 1024) |
| log of 0 < x < 1 | Negative result |
Common Uses
- •Chemistry: calculating pH from hydrogen ion concentration -- pH = -log10[H+], where each unit represents a 10x change in acidity
- •Seismology: comparing earthquake magnitudes on the Richter scale -- a magnitude 7 earthquake is 10x stronger than magnitude 6
- •Computer Science: analyzing algorithm efficiency -- binary search takes O(log2 n) comparisons, making it exponentially faster than linear search
- •Finance: computing compound annual growth rate (CAGR) and logarithmic returns for portfolio analysis
- •Acoustics: calculating sound intensity in decibels -- a 10 dB increase represents a 10x increase in sound intensity
Understanding the Result
Logarithms are the inverse of exponentiation. Just as division undoes multiplication, logarithms undo exponentiation. The fundamental relationship is: log_b(x) = y means b^y = x. For example, log2(8) = 3 because 2^3 = 8. Logarithms are essential in chemistry (pH = -log10[H+], where each unit represents a 10x change in acidity), physics (decibel and Richter scales are logarithmic), biology (population growth models), computer science (binary search, algorithm complexity analysis where log2 n appears constantly), and finance (logarithmic returns for compound interest). The change of base formula, log_b(x) = log_c(x) / log_c(b), is crucial because most calculators only provide log10 (common log) and ln (natural log) buttons. For example, to compute log2(100) on a standard calculator: log10(100) / log10(2) = 2 / 0.3010 = 6.644. The calculator shows this step-by-step. A key property: logarithms turn multiplication into addition (log(xy) = log(x) + log(y)), which is how slide rules worked before electronic calculators.
Worked Examples
Dr. Okonkwo, an environmental chemist, measures the hydrogen ion concentration of a lake water sample as [H+] = 3.16 x 10^-7 mol/L. She needs to calculate the pH to determine if the lake is acidic or basic.
base = 10 · value = 0.000000316
log10(0.000000316) ≈ -6.5, so pH = 6.5
pH = -log10(3.16 x 10^-7) = 6.5. A pH of 6.5 is slightly acidic (neutral is 7.0). This reading is within the normal range for natural freshwater (6.5-8.5), but Dr. Okonkwo should monitor for acid rain effects which could push the pH below 6.0 and harm aquatic life.
Maya, a software engineer, is analyzing a binary search algorithm that searches a sorted database of 1,000,000 records. She wants to know the maximum number of comparisons needed to find any record. The theoretical maximum is log2(n).
base = 2 · value = 1000000
log2(1,000,000) ≈ 19.93, meaning at most 20 comparisons
log2(1,000,000) = 19.93, so at most 20 comparisons are needed. Compare this to linear search which would need up to 1,000,000 comparisons in the worst case. Binary search is 50,000x more efficient. This is why large databases use indexed and tree-based structures (B-trees, binary search trees) -- logarithmic access time is critical for performance.
Alex, an audio engineer, is setting up a sound system. A speaker at 1 meter produces 90 dB. He needs to know the sound level at 32 meters (outdoor concert distance). Sound decreases with the square of distance: dB reduction = 20 x log10(distance/reference_distance).
base = 10 · value = 32
log10(32) ≈ 1.505, so sound reduction = 20 × 1.505 ≈ 30.1 dB
log10(32) = 1.505. Sound reduction = 20 x 1.505 = 30.1 dB. The sound level at 32 meters will be approximately 90 - 30 = 60 dB, about the level of normal conversation. Alex needs additional speakers or delay towers to provide adequate coverage for the entire audience area.
Frequently Asked Questions
- Why can't the base be 1 or negative?
- Logarithms with base 1 are undefined because 1 raised to any power is always 1. There is no unique exponent y such that 1^y = x (unless x=1, in which case every y works). Negative bases would produce complex numbers for non-integer exponents, which is outside standard real-valued logarithms. For example, log_-2(8) would require finding y such that (-2)^y = 8, which has no real solution.
- What is the change of base formula?
- The change of base formula is log_b(x) = log_c(x) / log_c(b) for any valid base c. Most commonly: log_b(x) = log10(x) / log10(b) or log_b(x) = ln(x) / ln(b). This lets you compute any logarithm using just the log10 or ln button on a standard calculator. It works because logarithms in different bases are proportional to each other.
- What is the difference between log and ln?
- log (common logarithm) has base 10. ln (natural logarithm) has base e (approximately 2.71828). Natural logarithms are used in calculus (the derivative of ln(x) is 1/x), exponential growth/decay models, and any context involving continuous compounding. Common logs are used in pH, Richter scale, and decibel measurements because these are defined with base 10. In higher mathematics and computer science, "log" without a specified base often means natural log or log base 2, depending on the field.
- What is the antilog (inverse log)?
- The antilogarithm is the inverse operation: if y = log_b(x), then the antilog is x = b^y. For common logs (base 10), antilog10(y) = 10^y. For natural logs, antiln(y) = e^y. Practical example: if pH = -log10[H+] = 5, then [H+] = 10^-5 = 0.00001 mol/L. Most scientific calculators have a 10^x or e^x button for computing antilogs.
- Why do we use log scales in science?
- Log scales compress vast ranges into manageable numbers. The Richter scale (earthquake magnitude) is logarithmic: a magnitude 8 releases about 31.6x more energy than a magnitude 7, not just 14% more. pH is logarithmic: lemon juice (pH 2) is 100,000x more acidic than water (pH 7). Decibels are logarithmic: a 20 dB increase means 100x more sound intensity. Without log scales, we would work with incomprehensible numbers like 10^-14 for [H+] or 10^12 for sound pressure.
- What is the relationship between exponents and logarithms?
- Logarithms and exponents are inverse operations, like addition/subtraction and multiplication/division. If b^y = x, then log_b(x) = y. You can think of it as: the exponent asks "b raised to what power gives x?" and the logarithm answers "y." Properties mirror each other: log_b(xy) = log_b(x) + log_b(y) mirrors b^(m+n) = b^m * b^n. log_b(x^p) = p * log_b(x) mirrors (b^m)^p = b^(mp).
- How are logarithms used in algorithm analysis?
- In computer science, log2(n) appears in the time complexity of divide-and-conquer algorithms. Binary search: O(log2 n) comparisons. Balanced binary search tree operations: O(log2 n). Merge sort: O(n log2 n) comparisons. An algorithm that is O(log n) can handle massive inputs: if n doubles, log n only increases by 1. This is why Google can search billions of web pages in milliseconds -- indexing uses logarithmic-time data structures.
Pro Tips
- →Use the change of base formula when your calculator lacks a custom base button. Any logarithm can be computed as log10(x) / log10(b) or ln(x) / ln(b). The result is the same regardless of which base you use for the conversion.
- →Logarithms turn multiplication problems into addition problems. Before electronic calculators, scientists multiplied large numbers by looking up their logarithms in tables, adding them, and finding the antilog. Understanding this property helps explain why log scales are so useful.
- →The natural log (ln, base e) appears everywhere in calculus because d/dx[ln(x)] = 1/x. If you are doing any calculus work involving logs, default to natural log rather than common log -- the derivative of log10(x) has an extra constant factor.
- →When the argument (x) is between 0 and 1, the logarithm is negative. For example, log10(0.01) = -2 because 10^-2 = 0.01. This trips up many students -- a negative log result is correct and expected when working with small numbers.
- →In computer science, log2(n) rounded up to the next integer tells you how many bits are needed to represent n distinct values. For example, log2(256) = 8, meaning 8 bits can represent 256 values (0-255).
Limitations to Know
- •Do not use this calculator with base 1 — log1(x) is undefined because 1 raised to any power is always 1, so there is no unique inverse. This calculator rejects base 1 inputs.
- •Zero or negative bases and zero or negative arguments (x ≤ 0) require complex number arithmetic beyond the scope of this real-valued logarithm calculator. The limit of log_b(0) is negative infinity.
- •Do not use logarithms on count data where zero values exist without adding a small constant first. Also avoid log transformation when the underlying relationship is known to be linear rather than multiplicative.
- •This calculator handles real-valued logarithms only. For complex logarithms (e.g., log10(-1) = iπ/ln(10)), modular logarithms, or discrete logarithms used in cryptography, use a dedicated tool.
Cite this calculator
TheCalcUniverse. "Logarithm Calculator — Custom Base, Natural Log, Common Log &." TheCalcUniverse, 2026, https://thecalcuniverse.com/math/log-calculator/. Accessed July 24, 2026.
Embed this calculator on your site
You may also like
-
Exponent Calculator
Raise any base to any power including negative, fractional, and decimal exponents. Shows expanded form, scient…
-
Root Calculator
Calculate any nth root — square roots, cube roots, and beyond. Shows both radical form and fractional exponent…
-
Scientific Calc
Full-featured online scientific calculator with trigonometric functions, logarithms, memory operations, and ca…
-
Sci Notation
Convert between decimal and scientific notation. Learn how the decimal point jumps left or right with an inter…