Text to Go Byte Slice Converter
Paste text to get a Go byte slice with each UTF-8 byte written in hexadecimal or decimal.
Worked example
Café[]byte{0x43, 0x61, 0x66, 0xc3, 0xa9}Café takes five UTF-8 bytes because é takes two. Those last two bytes are 0xc3 and 0xa9, or 195 and 169 in decimal. Choose Byte format to switch between them.
A byte slice literal is handy for test data or a binary example. If your Go code already has the string in a variable called s, []byte(s) gives you its bytes. See the Go language specification.