Sample code for 30+ languages & platforms
AutoIt

Convert any File to Base64 (and back)

Demonstrates how to get the contents of any file as a base64 string, and then write it back.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

$oBd = ObjCreate("Chilkat.BinData")

; This example will load a PDF and return it as a base64 string.
$bSuccess = $oBd.LoadFile("qa_data/pdf/helloWorld.pdf")
If ($bSuccess <> True) Then
    ConsoleWrite("Failed to load file." & @CRLF)
    Exit
EndIf

Local $sB64Str = $oBd.GetEncoded("base64")
ConsoleWrite($sB64Str & @CRLF)

; Now write the base64 string back to the binary PDF file:
$oBd2 = ObjCreate("Chilkat.BinData")
$bSuccess = $oBd2.AppendEncoded($sB64Str,"base64")
$bSuccess = $oBd2.WriteFile("qa_output/helloWorld.pdf")