JavaScript to Base64 encoder





Follow these steps to encode your JavaScript into Base64 data:

  1. Input your JavaScript content in the provided field.
  2. Click on the “Encode” button.
  3. Choose your preferred output format:

    Plain Text: Outputs only the Base64 data.

    Data URL: Base64 data in a data URL format (data:[<MIME-type>][;charset=<encoding>][;base64],<base64 data>).

    HTML JavaScript Tag: Generates an HTML <script> tag with the Base64 data in the SRC property.
  4. Copy or download the Base64 data as per your requirement.
  5. Done!

Output Format Examples:

Plain Text:

YWxlcnQoIkhlbGxvIGZyb20gQmFzZTY0Lk9ubGluZSIpOw==

Data URL:

data:text/javascript;base64,YWxlcnQoIkhlbGxvIGZyb20gQmFzZTY0Lk9ubGluZSIpOw==

HTML JavaScript Tag:

<script src=”data:text/javascript;base64,SYWxlcnQoIkhlbGxvIGZyb20gQmFzZTY0Lk9ubGluZSIpOw==”></script>

Feel free to input your JavaScript and experiment with different output formats!