This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Base 64 encoding of byte string or vector


res = base64encode(V)


res = base64encode(V) encodes V using base 64 encoding and returns the encoded characters as a string. For more information, see RFC 4648 — Section 4, Base 64 Encoding. Base 64 encoding is used in some contexts in internet messages where data must be transmitted in a limited set of ASCII characters. Use base64encode to encode strings containing special characters that might be misinterpreted as control characters by the transmission protocol. base64encode can encode arbitrary binary data.

If V is a string or character vector, base64encode first converts it to bytes using the user default encoding. To use a different character encoding, call the MATLAB® unicode2native function to convert V to a uint8 vector before passing it to base64encode.

Input Arguments

collapse all

Data to encode, specified as a string, character vector, or numeric vector.

Introduced in R2016b