Number.prototype.toExponential() formats a number as an exponential (scientific) string (same API as MDN Number.toExponential). Optional fractionDigits controls digits after the decimal. This tutorial covers syntax, special values, comparisons, five examples, and try-it labs.
01
Syntax
toExponential(digits)
02
Form
d.dddde±e
03
Digits
0 to 100
04
Default
As needed
05
Parse back
parseFloat
06
Baseline
Everywhere
Fundamentals
Introduction
Huge and tiny numbers are hard to read as plain decimals. Scientific notation writes them as a short mantissa times a power of ten — for example 1.23 × 105. In JavaScript that looks like "1.23e+5".
toExponential() builds that string for you. Use it for logs, science UIs, charts, and any place where a consistent exponential layout beats a long digit run.
Call number.toExponential() or number.toExponential(fractionDigits) on a number primitive or Number object. You always get a string; the number itself does not change.
The result has one digit before the decimal point (unless the number is zero), then an e+ or e- exponent. Negative numbers keep a leading -.
💡
Beginner Tip
Integer literals need parentheses or a space before the dot: (77).toExponential() or 77 .toExponential(). Otherwise 77.toExponential looks like a decimal to the parser.
Charts & axes — label scales that span many orders of magnitude.
Export / CSV — compact numeric text for very large ranges.
Teaching scientific notation — demonstrate mantissa and exponent live.
Not for money — prefer toFixed or a decimal library for currency.
🧠 How toExponential() Builds the String
1
Read the number
Must be a Number primitive or wrapper.
Input
2
Normalize mantissa
One digit before the decimal; pick the exponent.
Scale
3
Apply fractionDigits
Round or expand digits after the point (0–100).
Digits
4
✅
Return string
Form like "1.23e+5"; original number unchanged.
Important
📝 Notes
Does not change the number — returns a new string.
fractionDigits outside 0–100 throws RangeError.
Always uses exponential form (unlike toPrecision, which may stay plain).
Rounding follows the same floating-point rules as other Number formatters.
Infinity and NaN return "Infinity" / "NaN", not expo strings.
For locale-aware formatting, use toLocaleString() with suitable options — not toExponential.
Compatibility
Browser & Runtime Support
Number.prototype.toExponential() is Baseline Widely available — part of JavaScript since early ECMAScript editions and supported in every modern browser and Node.js.
✓ Baseline · Widely available
Number.prototype.toExponential()
Safe for production everywhere. Optional fractionDigits 0–100 works consistently across engines.
100%Universal support
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
Number.toExponential()Excellent
Bottom line: Use freely for scientific display. Prefer toFixed or decimal libraries for currency and exact decimal places.
Wrap Up
Conclusion
Number.prototype.toExponential() turns any number into a clear scientific string, with optional control over mantissa digits. It is ideal for logs, science UIs, and values that span many orders of magnitude.
Use parentheses for integer literals: (123456).toExponential(2)
Pick a small fractionDigits for readable charts and labels
Validate digits stay between 0 and 100
Parse with Number.parseFloat when you need the value again
Prefer toFixed when you need plain fixed decimals
❌ Don’t
Write 10.toExponential() without space/parens (syntax error)
Use exponential strings for currency amounts
Pass fractionDigits below 0 or above 100
Assume every engine prints -0 the same way
Confuse toExponential with toPrecision (different goals)
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about Number.toExponential()
Format numbers in scientific notation with optional digit control.
5
Core concepts
📝01
Returns
string
API
🔢02
Digits
0–100
Param
e03
Form
Always expo
Shape
−04
Sign
Kept
Negatives
⚡05
Safe
Baseline
Support
❓ 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.
Did you know?
In JavaScript source code you can also write numbers with exponents directly — 1.23e5 is the same value as 123000. toExponential() is the reverse direction: number → that style of text.