Encode JavaScript to Base64

The converter helps to encode JavaScript to Base64 data and then copy or download the result data in several formats. If you want to decode, use Base64 to JavaScript Decoder.

How to encode JavaScript to Base64 Data

  1. Input JavaScript content in the field;
  2. Press Encode button;
  3. Select output format (Plain Text, Data URL, HTML JavaScript tag);
  4. Copy or Download Base64 data;
  5. Done!

Output Formats

  • Plain Text - Only Base64 data;
  • Data Url - Base64 in data URL format (data:[<MIME-type>][;charset=<encoding>][;base64],<base64 data>)
  • HTML JavaScript Tag - HTML Tag <script> with Data Url data in SRC property.

Output Format Examples

Plain Text:

YWxlcnQoIkhlbGxvIGZyb20gQmFzZTY0Lk9ubGluZSIpOw==

Data Url:

data:text/javascript;base64,YWxlcnQoIkhlbGxvIGZyb20gQmFzZTY0Lk9ubGluZSIpOw==

HTML JavaScript Tag:

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