Base64 Decode Base64 Encode CSS Beautifier Url Encoder Url Decoder Image to Base64 Base64 to Image

Golang EncodeToString()

Encodes a string in base64 format.

Function

func (enc *Encoding) EncodeToString(src []byte) string

Parameters

src - The String to be encoded

Return value

EncodeToString returns the base64 encoding of src.

Example
package main
import b64 "encoding/base64"

func main() {
	data := "base64 encoded string"
	sEnc := b64.StdEncoding.EncodeToString([]byte(data))
}
Github

https://github.com/base64encode/examples/blob/master/base64encode.go

See also:
Go DecodeString