JavaScript Number toExponential() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Method

Definition

number.toExponential() returns a string of the number in exponential (scientific) notation: one digit before the decimal, then e+ or e- and an exponent. Useful for very large or very small values.

Pass the required arguments shown below. Check return values and browser support before you rely on the result.

Syntax

Call number.toExponential. Start with this line.

JavaScript
n.toExponential([fractionDigits])
CallWhat it does
n.toExponential([fractionDigits])Primary signature.
number.toExponential(...)Call with the arguments your case needs.

Built into JavaScript. Call toExponential(...) on a number (or Number instance) — no import required.

Library declarations
JavaScript
n.toExponential([fractionDigits])

Parameters

ParameterDescription
fractionDigitsOptional. Digits after the decimal (0–100)

Return Value

Return ValueDescription
*Exponential notation string

JavaScript Examples

Example 1 — Default Exponential Form

Omit the argument to keep as many digits as needed.

JavaScript
const n = 77.1234;

console.log(n.toExponential());
// "7.71234e+1"

console.log(typeof n.toExponential());
// "string"
Try It Yourself

How It Works

  1. Call the method. toExponential() with no args uses a default digit count.
  2. Scientific rewrite. 77.1234 becomes 7.71234 × 10¹.
  3. String result. You get "7.71234e+1", not a number you can multiply directly without parsing.
  4. typeof check. Confirms the return type is "string".

Example 2 — Control Fraction Digits

Pass 0–100 to set digits after the decimal.

JavaScript
const n = 77.1234;

console.log(n.toExponential(2));  // "7.71e+1"
console.log(n.toExponential(4));  // "7.7123e+1"
console.log(n.toExponential(0));  // "8e+1"
Try It Yourself

How It Works

  1. Two digits. Rounds the significand to two places → "7.71e+1".
  2. Four digits. Keeps more of the fraction → "7.7123e+1".
  3. Zero digits. No decimal part; rounds to "8e+1".
  4. Range. Values outside 0–100 throw a RangeError.

Example 3 — Large and Tiny Numbers

Exponential form shines when values are huge or near zero.

JavaScript
console.log((123456).toExponential(2));    // "1.23e+5"
console.log((0.000123).toExponential(2));  // "1.23e-4"

const s = (123456).toExponential(2);
console.log(Number(s));  // 123000
Try It Yourself

How It Works

  1. Large value. 123456 becomes 1.23 × 10⁵ → "1.23e+5".
  2. Tiny value. 0.000123 becomes 1.23 × 10⁻⁴ → "1.23e-4".
  3. Parse back. Number("1.23e+5") yields a number again.
  4. Rounding note. With only two digits, you get 123000, not the full original.

Browser & Runtime Support

Number.prototype.toExponential() is part of core JavaScript (ES3+) and is Baseline Widely available.

✓ Baseline · ES3+

Number.toExponential()

Supported in every browser and Node.js version. No polyfill needed for scientific-notation formatting.

99% Universal 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
toExponential Excellent

Bottom line: Safe everywhere. Use freely for scientific display; prefer toFixed for plain fixed decimals.

Frequently Asked Questions

Number.prototype.toExponential() returns a string of the number in exponential (scientific) notation — one digit before the decimal point, then an e+ or e- exponent. Example: (77.1234).toExponential() is "7.71234e+1".
fractionDigits is an optional integer from 0 to 100 that sets how many digits appear after the decimal point. If you omit it, JavaScript uses as many digits as needed to represent the number. Values outside 0–100 throw a RangeError.
toExponential() always uses scientific notation. toFixed() uses fixed decimal places in plain form. toPrecision() picks a total significant-digit count and may use either plain or exponential form depending on the value.
Like other Number methods, (77).toExponential() needs parentheses (or a space) so the parser does not treat the dot as a decimal point. 77.toExponential() is a syntax error.
Yes. Number() or Number.parseFloat() accept strings like "1.23e+5". That is useful when you format for display, then parse again for math.
It is part of early ECMAScript and is Baseline Widely available — safe in every modern browser and Node.js.

Next: toFixed()

Learn how toFixed() formats numbers with a fixed number of decimal places.

toFixed() 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.

10 people found this page helpful