How to Convert a String in Lowercase in Golang?

Last updated on September 18, 2023 by Ayaz Ali Shah

In golang, you can convert strings into lower case by using the ToLower() function from the string package. It accepts strings as an argument and converts into lower case.

The function ToLower() is case-sensitive, means that it should be written as ToLower(). If function name is written in lowercase or uppercase, an error will be returned. Therefore, it is important to ensure that the function name is written exactly as ToLower() to avoid any errors.


strings.ToLower(any string)


  • It takes one required parameter.
  • It accepts string value in the argument.

Return Value

The ToLower() function returns a lowercase string.


To use the ToLower() function you need to import the strings package into your go file. Below is the code that imports the strings package.

import (

Once a file has a strings package then you can convert the string into lower through the function. Let’s do it by following code,

strings.ToLower("Golang Tutorials")

The above line of code converts the into lowercase. To check the output we can use Println() function from fmt package that prints the string to the console.

fmt.Println(strings.ToLower("Golang Tutorials"))
// Output: golang tutorials

In this example, the ToLower() function converts string into lower case.


This article demonstrates how you can convert strings in lowercase. To do that it uses the ToLower() function from the strings package. The ToLower() function accepts string as an argument and returns it into lowercase.

Share on:

Related Posts

Tags: Golang, String,