Change of Base Formula
The change of base formula converts a logarithm in any base to a ratio of logarithms in a more convenient base, such as base 10 or base e.
Formula
\log_b(x) = \log(x) / \log(b) = \ln(x) / \ln(b)
Definition
The change of base formula lets you calculate any logarithm using a calculator that only has "log" or "ln" buttons: for any valid bases $a$ and $b$ and positive $x$, $\log_b(x) = \log_a(x) / \log_a(b)$, commonly written $\log_b(x) = \ln(x)/\ln(b) = \log(x)/\log(b)$. It follows directly from the definition, if $y = \log_b(x)$, then $b^y = x$, and taking $\log_a$ of both sides gives $y\log_a(b) = \log_a(x)$, so $y = \log_a(x)/\log_a(b)$. More deeply, this reflects that all logarithm functions differ only by a multiplicative constant, $\log_b(x) = (1/\ln(b)) \cdot \ln(x)$, they are all scalar multiples of the natural logarithm.
Example
To calculate $\log_5(20)$, since no "log base 5" button exists, use $\log_5(20) = \log(20)/\log(5) \approx 1.301/0.699 \approx 1.861$, and checking, $5^{1.861} \approx 20$. To solve $7^x = 150$, take $\log_7$ of both sides: $x = \log_7(150) = \ln(150)/\ln(7) \approx 5.011/1.946 \approx 2.575$. In information theory, switching between bits ($\log_2$) and nats ($\ln$) for Shannon entropy is exactly the change of base formula applied to entropy: $H = -\sum p_i \log_2(p_i)$ in bits versus $H_{\text{nat}} = -\sum p_i \ln(p_i)$ in nats, related by $H = H_{\text{nat}} / \ln(2)$, where $1/\ln(2) \approx 1.4427$ converts nats to bits.
Key Insight
Every logarithm can be converted to base $10$ or base $e$, making the change of base formula a kind of "universal translator" for logarithms, computable with any standard calculator. The formula demonstrates that there is essentially only one logarithm function, scaled differently for different bases: the choice of base is a convention suited to the application, not a mathematical necessity.