Number.toString() Convert to string
Last updated: 2026-09-09
Number.toString() Convert to string
toString converts a number to a string, optionally in a different base.
| Category | Numbers |
|---|---|
| ES version | ES1 |
📝 Syntax
const str = number.toString(radix);
⚙️ Parameters
| radix | Optional. Base 2~36; default 10. |
|---|
Returns:The string representation.
Mutates the original:No (returns a new value)
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
255
ff
11111111
377
💡 Tip toString(2) and toString(16) are the standard base conversions.
ℹ️ info String(n) and n.toString() are equivalent; String() is safer for null/undefined.
🌐 Browser support
| Browser | |||||
|---|---|---|---|---|---|
| Number.toString() | ✓ v1 | ✓ v12 | ✓ v1 | ✓ v1 | ✓ v1 |
| Supported by all modern browsers | |||||
🏷️ Related Items
💡 Related Cases
More case studies coming soon — check back later.
📚 Related Tutorials
❓ FAQ
QAny base?
ABase 2~36.
QDoes toString mutate?
ANo — returns a new string.
QHow to convert back?
AparseInt(str, radix) or Number(str).