tolower() Convert a letter to lowercase

tolower() Convert a letter to lowercase

tolower() maps uppercase to lowercase in the current locale, leaving others unchanged. Pass EOF or unsigned char; it cannot decode UTF-8.

Categoryctype.h character classes
KindLibrary function
Header<ctype.h>
C standardC89 / C90

📝 Syntax

int tolower(int c);

⚙️ Parameters

c RequiredThe character to convert, represented as an unsigned char value or EOF.

Returns: Returns the lowercase equivalent when one exists, or c unchanged otherwise.

▶ Example

Edit the C code below and click Run; the server compiles and executes it:

Output:

hello 123
⚠️ Warning Passing a negative plain char value causes undefined behavior. Convert to unsigned char first; EOF may be passed directly.
💡 Tip tolower() returns the converted character value and does not modify an object in place.

📚 Related Tutorials

❓ FAQ

QHow do I convert an entire string with tolower?
AIterate through a writable character array, pass each element as unsigned char to tolower, and assign the result back to that element.
QDoes tolower behave identically in every locale?
ANot necessarily; case mappings depend on the current locale. The default C locale guarantees basic A-Z to a-z conversion, while other language rules can differ.
QCan tolower convert a UTF-8 string byte by byte?
AIt cannot serve as a general Unicode lowercase conversion. Multibyte UTF-8 sequences must be decoded as a whole; byte-by-byte processing can encounter negative char arguments and cannot express case mappings that span bytes. Restrict the input range when handling only basic Latin letters, and use a dedicated library for full Unicode text.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

Content reviewed by MOTO · Found an error? Report it

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏