JavaScript Math.LN10 Constant

Beginner
5 min read
Updated: Nov 2026
3 examples
Constant

Definition

Math.LN10 is a built-in constant that holds the natural logarithm of 10, about 2.302585092994046. You read it as a property. You do not call it.

Read the value, use it in your math, and check the examples below for common patterns.

Syntax

Read the constant. Start with this line.

JavaScript
Math.LN10
UsageWhat it does
Math.LN10Read the natural logarithm of 10.

Built into JavaScript. Read Math.LN10 directly from the Math object — no parentheses and no import required.

Library declarations
JavaScript
Math.LN10

Parameters

None. Math.LN10 is a constant (a fixed value), not a function. Do not add parentheses.

Return Value

Return ValueDescription
NumberAbout 2.302585092994046.

JavaScript Examples

Example 1 — Read the Value of Math.LN10

No parentheses are needed.

JavaScript
console.log(Math.LN10); // 2.302585092994046
console.log(Math.LN10.toFixed(4)); // 2.3026
console.log(Math.log(10).toFixed(10) === Math.LN10.toFixed(10)); // true
Try It Yourself

How It Works

  1. Plain property. Math.LN10 is a value, not a function.
  2. Short form. toFixed(4) keeps 4 decimals.
  3. Same as log(10). Math.log(10) gives the same number.
  4. Why it exists. It saves you from calculating Math.log(10) again and again.

Example 2 — Log Base 10 the Old Way

Divide a natural log by Math.LN10 to get a base-10 log. Compare it with Math.log10().

JavaScript
console.log(Math.log(1000) / Math.LN10); // 2.9999999999999996
console.log((Math.log(1000) / Math.LN10).toFixed(4)); // 3.0000
console.log(Math.log10(1000)); // 3
Try It Yourself

How It Works

  1. Change of base. Math.log(x) / Math.LN10 is the base-10 log of x.
  2. Tiny error. The raw answer is 2.9999999999999996, not exactly 3.
  3. Round it. toFixed(4) shows "3.0000".
  4. Better choice. Math.log10(1000) is exactly 3.

Example 3 — Count the Digits in a Number

The number of digits is the base-10 log, rounded down, plus 1.

JavaScript
function digitCount(n) {
  return Math.floor(Math.log(n) / Math.LN10) + 1;
}

console.log(digitCount(5)); // 1
console.log(digitCount(42)); // 2
console.log(digitCount(12345)); // 5
Try It Yourself

How It Works

  1. Log. Math.log(n) / Math.LN10 is the base-10 log of n.
  2. Round down. Math.floor() removes the decimals.
  3. Add one. A number like 42 has log 1.6, floor 1, plus 1 is 2 digits.
  4. Careful. Exact powers like 1000 can be off by one. Use Math.log10() for those.

Browser & Runtime Support

Math.LN10 is part of the first JavaScript standard (ES1) and is Baseline Widely available in every browser and in Node.js.

✓ Baseline · ES1

Math.LN10

A long-standing constant. It works in Chrome, Firefox, Safari, Edge, Internet Explorer and Node.js.

99% Modern browser support
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
Math.LN10 Excellent

Bottom line: Use Math.LN10 anywhere. It works in all browsers.

Frequently Asked Questions

It is the natural logarithm of 10, about 2.302585092994046.
No. It is a number. Write Math.LN10 without parentheses.
Use Math.log10(x). It is more accurate than Math.log(x) / Math.LN10.
Computers store decimals with tiny rounding errors, so the result is 2.9999999999999996. Math.log10(1000) returns exactly 3.
Yes. They have the same value. Math.LN10 is ready to read without calling a function.
All of them. It is part of the first JavaScript standard and works in every browser and in Node.js.

Next: LN2

Learn about natural log of 2.

LN2 tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful