Logarithm Calculator – log, ln & Any Base
Enter a positive number \(x\). Choose ln, log\(_{10}\), log\(_2\), or any base \(b\). We’ll compute logs and show the matching antilog.
Results
What this calculator uses
- Change of base: \(\log_b(x)=\dfrac{\ln(x)}{\ln(b)}\) (with \(x>0\), \(b>0\), \(b\neq 1\)).
- Antilog: If \(y=\log_b(x)\) then \(x=b^y\).
- Common logs: \(\log_{10}(x)=\ln(x)/\ln(10)\), \(\log_2(x)=\ln(x)/\ln(2)\).
Tip: you can paste numbers in E-notation like 3.2e-7.
Frequently Asked Questions
Why is my input “undefined”?
For real logs, the input \(x\) must be strictly positive. The base \(b\) must be positive and not equal to 1.
How accurate are the results?
We use JavaScript’s double-precision math. You can change decimal places; internal math uses full precision.
Is everything private?
Yes — all calculations run in your browser.
Logarithms Explained (ln, log10, log2, and log base b)
A logarithm answers the question: “To what power must the base be raised to get \(x\)?” In symbols, \(\log_b(x)=y \iff b^y=x\). Our logarithm calculator supports natural log \(\ln(x)\) (base \(e\)), common log \(\log_{10}(x)\), binary log \(\log_{2}(x)\), and any base \(b\) using the change-of-base formula.
Key Formulas
- Change of base: \(\displaystyle \log_b(x)=\frac{\ln(x)}{\ln(b)}\) (\(x>0,\;b>0,\;b\neq1\)).
- Antilog (inverse): if \(y=\log_b(x)\) then \(x=b^{y}\).
- Product / Quotient: \(\log_b(xy)=\log_b x+\log_b y,\;\; \log_b\!\left(\frac{x}{y}\right)=\log_b x-\log_b y\).
- Power rule: \(\log_b(x^p)=p\,\log_b x\).
- Common bases: \(\log_{10}x=\dfrac{\ln x}{\ln 10},\;\; \log_{2}x=\dfrac{\ln x}{\ln 2}\).
Domain & Quick Checks
- For real numbers, you must have \(x>0\) and \(b>0,\;b\neq1\).
- \(\log_b(1)=0\), \(\log_b(b)=1\), and \(\ln(e)=1\).
- \(\log_b(0)\) is undefined (tends to \(-\infty\)), and \(\log_b(x<0)\) is not real.
Worked Examples
- \(\log_{5}(125)=?\) → since \(5^3=125\), \(\log_{5}(125)=3\).
- \(\log_{2}(32)=5\) because \(2^5=32\).
- \(\log_{7}(50)=\dfrac{\ln 50}{\ln 7}\) → use the calculator’s “any base” mode.
Real-World Uses
- pH scale: \(\mathrm{pH}=-\log_{10}[\mathrm{H}^+]\) (acidity).
- Decibels: \(L=10\log_{10}\!\left(\frac{P}{P_0}\right)\) (power ratios).
- Information / bits: number of bits to encode \(N\) outcomes is \(\log_{2} N\).
- Growth & half-life: \(x(t)=x_0 e^{kt}\). Solving for time: \(t=\dfrac{\ln(x/x_0)}{k}\).
- Compound interest: \(F=P(1+r)^t \Rightarrow t=\dfrac{\ln(F/P)}{\ln(1+r)}\).
Digits & Order of Magnitude (handy facts)
- Number of decimal digits for integer \(n>0\): \(\;\displaystyle \big\lfloor \log_{10}(n) \big\rfloor + 1\).
- Order of magnitude: \(\displaystyle \mathrm{oom}(x)=\big\lfloor \log_{10}(|x|) \big\rfloor\).
Precision tip (optional nerdy note)
For \(x\) very close to 1, \(\ln(x)=\ln(1+u)\) with \(u=x-1\) is more stable; many browsers expose log1p(u)
.
This logarithm calculator runs 100% client-side for privacy and supports E-notation inputs (e.g., 3.2e-7).