Mathematics · Algebra
Logarithm Calculator
Calculate a logarithm with any valid positive base.
Inputs and results stay in this browser. Change one value at a time to explore the relationship.
Calculation steps
- Compute ln(32) ÷ ln(2).
- The quotient is 5.
- Therefore 2^5 = 32.
Understand Logarithm
One idea, three depths
Choose how deeply to explain Logarithm
Logarithm calculator: Calculate a logarithm with any valid positive base.
Age 5Explain it to a 5-year-oldStart with a picture
Imagine a magic copy machine that doubles what you have each time. Starting with 1 gives 2, 4, 8, 16 and then 32. A logarithm asks, ‘How many doublings did that take?’ Here the answer is 5.
Age 15Explain it to a 15-year-oldConnect it to the formula
A logarithm reverses exponentiation. Because 2⁵ = 32, log₂(32) = 5. For any valid base b, the calculator asks which exponent y makes bʸ = x, then finds y with ln(x) ÷ ln(b).
CollegeExplain it at college levelState the model precisely
For x > 0, b > 0 and b ≠ 1, log_b(x) is the inverse of the exponential map y ↦ bʸ. The change-of-base identity log_b(x) = ln(x)/ln(b) follows because ln(x) = ln(bʸ) = y ln(b).
Inputs and valid domain
- Value x must be a finite real number, at least 0.000001.
- Base b must be a finite real number, at least 0.000001.
Important boundary: The value and base must be positive, and the base cannot equal 1.
The formula
log_b(x) = ln(x) ÷ ln(b)
How the calculator works through it
It substitutes Value x, Base b into the formula and exposes every numerical step above. The main output is Logarithm.
Read the result correctly
The Logarithm is the direct answer to “calculate a logarithm with any valid positive base.” Read it with the units shown beside the inputs; a sign, angle, percentage or rate changes what the number means.
A worked check
log₂(32) = 5 because 2⁵ = 32.
Where this model stops being reliable
The value and base must be positive, and the base cannot equal 1.
Learn it by changing one value
Begin with the worked example, then change one value while keeping the others fixed. Compare the new result and calculation steps to identify which part of the formula changed.
Dictionary terms behind this calculator
Before studying the codeWhat you should know firstUse the calculator immediately, or check the foundations before reading the implementation.
These foundations help you understand why Logarithm works. They never block the calculator, and “optional” means useful context rather than a hidden requirement.
Hard requirements
- Reading formulas and substituting values
Logarithm uses log_b(x) = ln(x) ÷ ln(b). You need to recognise what each side represents before substituting the stated inputs or rearranging the relationship.
Review this foundation about 4 min
Strong support
- Functions and input-output rules
A function viewpoint helps you see how changing an input changes the Logarithm result.
Review this foundation about 5 min
Optional enrichment
- Powers and exponents
Powers are not required for every Logarithm calculation, but they make related algebraic forms and code easier to read.
Review this foundation about 4 min
Mathematics → algorithm → program
Implement this calculation in code
These are direct reference implementations of the calculator's principal relationship and first output. They run locally and include a small known-answer check where the language supports it.
Algorithm
- Reject a non-positive value, a non-positive base, or a base equal to one.
- Take the natural logarithm of the value and of the base.
- Divide ln(value) by ln(base); the quotient is the exponent that produces the value.
Python
from math import log
def log_base(value: float, base: float) -> float:
if value <= 0 or base <= 0 or base == 1:
raise ValueError("value > 0, base > 0, and base != 1 required")
return log(value) / log(base)
assert abs(log_base(32.0, 2.0) - 5.0) < 1e-12
C
#include <assert.h>
#include <math.h>
double log_base(double value, double base) {
if (value <= 0.0 || base <= 0.0 || base == 1.0)
return NAN;
return log(value) / log(base);
}
int main(void) {
assert(fabs(log_base(32.0, 2.0) - 5.0) < 1e-12);
}
C++
#include <cassert>
#include <cmath>
#include <stdexcept>
double log_base(double value, double base) {
if (value <= 0.0 || base <= 0.0 || base == 1.0)
throw std::domain_error("invalid logarithm domain");
return std::log(value) / std::log(base);
}
int main() {
assert(std::abs(log_base(32.0, 2.0) - 5.0) < 1e-12);
}
Linux x86-64 assembly
x86-64 NASM · System V ABI · Linux · x87 FYL2X
; double log_base(double value, double base)
; xmm0=value, xmm1=base, result=xmm0
; Returns NaN for invalid domains through the x87 operation.
global log_base
section .text
log_base:
sub rsp, 16
movsd [rsp], xmm0
movsd [rsp + 8], xmm1
fld1
fld qword [rsp]
fyl2x ; ST0 = log2(value)
fld1
fld qword [rsp + 8]
fyl2x ; ST0 = log2(base), ST1 = log2(value)
fdivp st1, st0 ; log2(value) / log2(base)
fstp qword [rsp]
movsd xmm0, [rsp]
add rsp, 16
ret
MATLAB
function result = log_base(value, base)
if value <= 0 || base <= 0 || base == 1
error("value > 0, base > 0, and base ~= 1 required");
end
result = log(value) / log(base);
end
Wolfram Language
ClearAll[mwCalculate];
mwCalculate[value_, base_] /; value > 0 && base > 0 && base != 1 := Log[value]/Log[base];
Continue in mathematical software
The downloaded file includes your current inputs and first calculated result. It is created locally.
Floating-point answers can differ slightly by language, compiler and processor. Compare within a suitable tolerance rather than assuming every decimal representation will be identical.
Supporting sourcesAcademic referencesPrimary standards, textbooks and complete citations
Standards, reading and academic references
Use the calculator as the worked interaction, then consult the primary standards and academic textbooks listed below. MW SysArc links to the original sources; the explanation on this page is original and does not reproduce them.
Algebra and Trigonometry 2e
Read the related free OpenStax mathematics chaptersCite this book
- APA 7
- Abramson, J. (2021). Algebra and trigonometry 2e. OpenStax. https://openstax.org/books/algebra-and-trigonometry-2e/pages/1-introduction-to-prerequisites
- MLA 9
- Abramson, Jay. Algebra and Trigonometry 2e. OpenStax, 2021, https://openstax.org/books/algebra-and-trigonometry-2e/pages/1-introduction-to-prerequisites.
- Chicago author-date
- Abramson, Jay. 2021. Algebra and Trigonometry 2e. Houston, TX: OpenStax. https://openstax.org/books/algebra-and-trigonometry-2e/pages/1-introduction-to-prerequisites.
OpenStax entries are free to read online. Follow the licence shown on each linked source before redistributing or adapting its content.
Reuse the page responsiblyCite this pageAPA, MLA, Chicago, Harvard, BibTeX and RIS
These formats cite this calculator page itself. They are separate from the academic references above, which support the mathematical method and terminology.
APA 7
MW SysArc. (2026, July 21). Logarithm Calculator. MW SysArc Tools. https://math.mwsysarc.com/algebra/logarithm-calculator
MLA 9
MW SysArc. “Logarithm Calculator.” MW SysArc Tools, 21 July 2026, https://math.mwsysarc.com/algebra/logarithm-calculator. Accessed 31 Aug. 2026.
Chicago 17
MW SysArc. “Logarithm Calculator.” MW SysArc Tools. Published July 21, 2026. Accessed August 31, 2026. https://math.mwsysarc.com/algebra/logarithm-calculator.
Harvard
MW SysArc (2026) ‘Logarithm Calculator’, MW SysArc Tools. Published 21 July 2026. Available at: https://math.mwsysarc.com/algebra/logarithm-calculator (Accessed: 31 August 2026).
BibTeX and RIS records
BibTeX
@misc{mwsysarc_logarithm_2026,
author = {{MW SysArc}},
title = {Logarithm Calculator},
howpublished = {MW SysArc Tools},
year = {2026},
url = {https://math.mwsysarc.com/algebra/logarithm-calculator},
note = {Published July 21, 2026; accessed August 31, 2026}
}RIS
TY - ELEC
AU - MW SysArc
TI - Logarithm Calculator
T2 - MW SysArc Tools
PY - 2026
DA - 2026-07-21
Y2 - 2026-08-31
UR - https://math.mwsysarc.com/algebra/logarithm-calculator
N1 - Published July 21, 2026
ER -Clear answers
Frequently asked questions
What does the Logarithm do?
Calculate a logarithm with any valid positive base.
How does the Logarithm work?
The calculator applies log_b(x) = ln(x) ÷ ln(b). A logarithm answers which exponent on the base produces the selected value.
What can I learn from the Logarithm?
It connects the mathematical rule to your chosen numbers and shows each calculation step. Change one input at a time to see how the result responds.
Does MW SysArc receive or store what I enter?
No. The calculation runs locally in your browser. MW SysArc does not receive or store your calculation inputs.
How should I use the result?
Use the steps to understand the method, then verify important school or professional work using the notation and rounding rules required in your setting.
Last reviewed . Calculations tested .