Window btoa() Method

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








googletag.cmd.push(function() googletag.display('div-gpt-ad-1422003450156-2'); );



Window btoa() Method


❮ Window Object



Example


Encode a string in base-64:



var str = "Hello World!";
var enc = window.btoa(str);

var res = "Encoded String: " + enc;

<!--

The result of res will be:



Encoded String: SGVsbG8gV29ybGQh
-->
Try it Yourself »


Definition and Usage


The btoa() method encodes a string in base-64.


This method uses the "A-Z", "a-z", "0-9", "+", "/" and "=" characters to encode the string.


Tip: Use the atob() method to decode a base-64 encoded string.



Browser Support


The numbers in the table specify the first browser version that fully supports the method.














Method
btoa() Yes 10.0 1.0 Yes Yes

Syntax



window.btoa(str)

Parameter Values






Parameter Description
str Required. The string to be encoded

Technical Details




Return Value: A String, representing the base-64 encoded string


❮ Window Object

Popular posts from this blog

PHP code is not being executed, instead code shows on the page

Administrative divisions of China

Cardinality of the set of algorithms