How can we convert a string into lowercase in Golang?

String in Golang is different from other programming languages like Java and C++. Strings in the Go language are a series of bytes that usually represents the text characters. Now, the bytes in the strings can be represented in the Unicode Text using the UTF-8 encoding, because of which we can represent any language present in the world using Go strings.

Now, how can we convert a string into its lowercase representation?

We can easily do that by using the ToLower() function of the strings package. This post will look at how we can convert a string to lowercase using the ToLower() function.

package main

import (

func main() {

	string1 := "**Hi CODEKRU**"
	string2 := "LeaRnINg GoLang"
	string3 := "lowercase string"

	fmt.Println("Original Strings: ")

	string1 = strings.ToLower(string1)
	string2 = strings.ToLower(string2)
	string3 = strings.ToLower(string3)

	fmt.Println("After using ToLower() method: ")


Output –

**hi codekru**
learning golang
lowercase string

That’s it. We hope that you have gotten your solution. If you have any doubts or concerns, please feel free to write us in the comments or mail us at

Liked the article? Share this on

Leave a Comment

Your email address will not be published. Required fields are marked *