YouTip LogoYouTip

Met Win Btoa

Window btoa() Method

Window Object Reference Window Object


Definition and Usage

The btoa() method is used to create a base-64 encoded string.

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

The base-64 decoding method is atob().

Syntax

window.btoa(str)

Parameter Description:

  • str: Required. The string to be encoded.

Return Value

This method returns a base-64 encoded string.


Browser Support

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

Method Chrome Edge Firefox Safari Opera
btoa() Yes 10.0 1.0 Yes Yes

Example

Example

Create a base-64 encoded string:

var str = "TUTORIAL";
var enc = window.btoa(str);
var res = "Encoded string: " + enc;

Try it Β»


Window Object Reference Window Object

← Met Win MatchmediaPython3 Func Zip β†’