how to convert array of bytes to string in golang?

Hi Friends 👋,

Welcome To aGuideHub! ❤️

To convert array of bytes to string in golang, just use string() method it will convert array of bytes to string. Only you have to pass array of bytes in the string().

Follow the below tutorial if you are struggling with installing GO in windows.

Today, I will show you how do I convert array of bytes to string in golang, as above mentioned I’m going to use string() way.

Let’s start our Golang convert array of bytes to string example


package main

import "fmt"

func main() {

     data := []byte{102, 97, 108, 99, 111, 110}


In the above example, we have converted type []byte to string and printed in golang console. let’s check the output.


[102 97 108 99 111 110]

I hope it helps you, All the best 👍.

Try it Yourself

Premium Content

You can get all the below premium content directly in your mail when you subscribe us


Portfolio Template

View | Get Source Code

Cheat Sheets

Cheat Sheets Books are basically Important useful notes which we use in our day-to-day life.

I'm working on some more Cheat Sheets book on Jquery, TypeScript, React js and for other languages. I will send it once it's completed.

Stay tuned working on React Js Cheat Sheets Book

Related Posts