VOOZH about

URL: https://www.geeksforgeeks.org/html/html-dom-window-btoa-method/

⇱ HTML | DOM Window btoa() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML | DOM Window btoa() Method

Last Updated : 5 Aug, 2022

The Window btoa() method is used for encoding a string in base-64 format. 
The characters used by the Window btoa() method to encode the string are "A-Z", "a-z", "0-9", "+", "/" and "=" .

Syntax: 

window.btoa(String)

Parameters Used: 

  • String: It is a mandatory parameter which specifies the string to be encoded.

Return Value: It returns a string that represents the encoded string of base-64.

Below program illustrates the Window btoa() Method:

Encoding a string in base-64 format. 

Output: 

👁 Image

After clicking the button:

👁 Image

Supported Browsers: The browser supported by Window btoa( ) Method are listed below: 

  • Google Chrome 4
  • Edge 12
  • Internet Explorer 10
  • Firefox 1
  • Opera 10.5
  • Safari 3
Comment
Article Tags: