({{, (RefLink[BaseDecode, paclet:ref/BaseDecode])["string"] 
decodes the Base64 data contained in a string and returns the result as a byte array.}})

OpenersNotesSection(Spacer1)Details

The result of (RefLink[BaseDecode, paclet:ref/BaseDecode])["string"] is a (RefLink[ByteArray, paclet:ref/ByteArray]) object.

(RefLink[BaseDecode, paclet:ref/BaseDecode]) uses the default encoding scheme described in the internet standard recommendation RFC 4648.

OpenersPrimaryExamplesSection(Spacer1)Examples  (8)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Decode a Base64-encoded string:

BaseDecode["AQIDBAUGBwgJCgsMDQ4PEBESExQ="]

OpenersExampleSection1(Spacer1)Scope  (1)

Encode the bytes 1 through 12:

bytes=ByteArray[Range[12]]

BaseEncode[%]

The bytes can be recovered using (RefLink[BaseDecode, paclet:ref/BaseDecode]):

BaseDecode[%]//Normal

OpenersExampleSection3(Spacer1)Properties & Relations  (5)

Characters outside the valid alphabet are automatically dropped:

BaseDecode["ABαCD"]==BaseDecode["ABCD"]

(RefLink[BaseEncode, paclet:ref/BaseEncode]) is the inverse of (RefLink[BaseDecode, paclet:ref/BaseDecode]):

BaseDecode["ABCD"]

BaseEncode[%]

(RefLink[BaseEncode, paclet:ref/BaseEncode]) decodes a Base64-encoded string to binary data:

BaseDecode["ezEsIDIsIDMsIDQsIDV9"]

%//Normal

The import format "Base64" decodes a Base64 string and converts the resulting bytes to a string:

ImportString["ezEsIDIsIDMsIDQsIDV9","Base64"]

Achieve the same result with (RefLink[BaseDecode, paclet:ref/BaseDecode]) and (RefLink[ByteArrayToString, paclet:ref/ByteArrayToString]):

ByteArrayToString[BaseDecode["ezEsIDIsIDMsIDQsIDV9"],"ISO8859-1"]

(RefLink[BaseDecode, paclet:ref/BaseDecode]) converts the "Base64Encoding" format of (RefLink[Hash, paclet:ref/Hash]) to its "ByteArray" format:

BaseDecode@Hash["My String","CRC32","Base64Encoding"]==Hash["My String","CRC32","ByteArray"]

(RefLink[ByteArray, paclet:ref/ByteArray]) uses Base64 encoding of its data in (RefLink[InputForm, paclet:ref/InputForm]):

ByteArray["AQID"]==BaseDecode["AQID"]

OpenersExampleSection4(Spacer1)Possible Issues  (1)

Inputs must be properly padded to the correct length:

BaseDecode["AB=="]

BaseDecode["AB"]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[BaseEncode, paclet:ref/BaseEncode])  ▪  (RefLink[ImportString, paclet:ref/ImportString])  ▪  (RefLink[StringToByteArray, paclet:ref/StringToByteArray])  ▪  (RefLink[ByteArrayToString, paclet:ref/ByteArrayToString])  ▪  (RefLink[ByteArray, paclet:ref/ByteArray])  ▪  (RefLink[Uncompress, paclet:ref/Uncompress])}, {Related Formats:  (RefLink[Base64, paclet:ref/format/Base64])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Binary Data, paclet:guide/BinaryData])}, {▪(RefLinkPlain[Systems-Related String Operations, paclet:guide/SystemsRelatedStringOperations])}, {▪(RefLinkPlain[Cryptographic Number Theory, paclet:guide/CryptographicNumberTheory])}, {▪(RefLinkPlain[Importing and Exporting, paclet:guide/ImportingAndExporting])}, {▪(RefLinkPlain[Cryptography, paclet:guide/Cryptography])}, {▪(RefLinkPlain[Network Programming, paclet:guide/NetworkProgramming])}})}})