Easy Tutorial
❮ Prop Nav Language Prop Screen Availheight ❯

Window btoa() Method

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:

Return Value


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

Example

Create a base-64 encoded string:

var str = "tutorialpro";
var enc = window.btoa(str);

var res = "Encoded string: " + enc;

Window Object

❮ Prop Nav Language Prop Screen Availheight ❯