Main Content

Base 64 decoding of string


res = base64decode(V) decodes V, which was encoded using base 64 encoding, and returns the decoded byte array. For more information, see RFC 4648 — Section 4, Base 64 Encoding. Base 64 encoding is used in some contexts in internet messages where arbitrary data must be transmitted in the form of ASCII characters.

In the input string, any characters not in the set of 65 characters defined for base 64 encoding are ignored. Decoding stops at the end of the string or at the first occurrence of an equal sign character (=).

If you know that the encoded data was a character string, you can convert it back to a string using the MATLAB® native2unicode(res) function. This function uses the user default encoding in effect at the time the string was encoded.

Input Arguments

collapse all

Text encoded using base 64, specified as a string or character vector.

Version History

Introduced in R2016b