Skip to main content

base64

Jump to function (4)

base64/decode#

(decode s & [strict?])

Decodes a Base64 string. When strict? is true, validates that the input contains only characters from the Base64 alphabet and returns false on invalid input (defaults to false).

Example:

(decode "SGVsbG8=") ; => "Hello"

base64/decode-url#

(decode-url s & [strict?])

Decodes a URL-safe Base64 string, adding padding automatically. When strict? is true, validates that the input contains only valid Base64 characters (defaults to false).

Example:

(decode-url "SGVsbG8") ; => "Hello"

base64/encode#

(encode s)

Encodes a string to Base64.

Example:

(encode "Hello") ; => "SGVsbG8="

base64/encode-url#

(encode-url s)

Encodes a string to URL-safe Base64 (no padding).

Example:

(encode-url "Hello") ; => "SGVsbG8"