Sample code for 30+ languages & platforms
B4X

Base64 Encode/Decode a String

See more Encryption Examples

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

Chilkat B4X Downloads

B4X
Dim success As Boolean = False

Dim bd As ChilkatBinData
bd.Initialize

Dim s As String = "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")

Dim strBase64 As String = bd.GetEncoded("base64")
Log(strBase64)

'  To decode:
Dim bd2 As ChilkatBinData
bd2.Initialize
bd2.AppendEncoded(strBase64, "base64")

Dim decoded As String = bd2.GetString("utf-8")
Log(decoded)