English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Window btoa() Method

JavaScript Window Object

btoa()Method encoding base-64The string.

This method uses the string "AZ", "az", "0-9”,“ +”,“ /Encode the string using the " and " = " characters.

Usageatob()Method for base-64Decode the encoded string.

Syntax:

window.btoa(str)
var str = "Hello World";
var enc = window.btoa(str);
var ans = "String Encoding: " + enc;
Test See‹/›

Browser Compatibility

The number in the table specifies the first browser version that fully supports the btoa() method:

Method
btoa()Is1IsIs10

Parameter Value

ParameterDescription
strTo encode the string

Technical Details

Return Value:A string representing base-64Encoded String

Related References

Window (Window) Reference:atob() Method

JavaScript Window Object