Base64 Decode Base64 Encode
More Tools
Other tools: Base64 Image Encoder | Base64 Image Decoder | Url Encoder | Url Decoder

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