Sample code for 30+ languages & platforms
VBScript

Base64 Encode/Decode a String

See more Encryption Examples

_LANGUAGE_ example to base-64 encode and decode a string.

Chilkat VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

set bd = CreateObject("Chilkat.BinData")

s = "A friend called me up the other day and talked about investing in a dot-com that sells lobsters. Internet lobsters. Where will this end? --Donald Trump"

success = bd.AppendString(s,"utf-8")

strBase64 = bd.GetEncoded("base64")
outFile.WriteLine(strBase64)

' To decode:
set bd2 = CreateObject("Chilkat.BinData")
success = bd2.AppendEncoded(strBase64,"base64")

decoded = bd2.GetString("utf-8")
outFile.WriteLine(decoded)

outFile.Close