Go Base64 Encoding


  • func (enc *base64.Encoding) Encode(dst, src []byte)
  • func (enc *base64.Encoding) Decode(dst, src []byte) (n int, err error)
  • func (enc *base64.Encoding) EncodeToString(src []byte) string
  • func (enc *base64.Encoding) DecodeString(s string) ([]byte, error)


The encoding/base64 package contains several built in encoders. Most of the examples in this document will use base64.StdEncoding, but any encoder (URLEncoding, RawStdEncodign, your own custom encoder, etc.) may be substituted.