Last Updated : 12 Jul, 2025
The BigInt.toString() method is an inbuilt method in JavaScript that is used to return a string representing the specified BigInt object.
Syntax:
bigIntObj.toString( radix )
Parameters: This function accepts a single parameter and it is optional.
Return value: This method returns a string representing the specified BigInt object.
Exceptions: A RangeError is thrown if the toString() is less than 2 or greater than 36 in the radix.
The below examples illustrate the BigInt.prototype.toString() method in JavaScript:
Example 1: This example shows the use of the BigInt.prototype.toString() method in JavaScript.
javascript
<script>
console.log(1023n.toString());
console.log(1023n.toString(2));
console.log(1023n.toString(9));
console.log((-0n).toString());
console.log(BigInt(-0).toString());
</script>
Output:
"1023" "1111111111" "1356" "0" "0"
Example 2: This example shows the use of the BigInt.prototype.toString() method in JavaScript.
javascript
<script>
console.log(17n.toString());
console.log(66n.toString(2));
console.log(254n.toString(16));
console.log(-10n.toString(2));
console.log(-0xffn.toString(2));
</script>
Output:
"17" "1000010" "fe" -1010 -11111111
We have a complete list of Javascript BigInt Methods, to check those please go through the Javascript BigInt Complete Reference article.
Supported Browsers: The browsers supported by BigInt.prototype.toString() method are listed below:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4