According to the documentation, they are just synonyms. size() exists to be compatible with other STL containers (such as vector, map, and so on), while length() exists to be consistent with most people's intuitive understanding of character strings. People normally talk about the length of a word, phrase, or paragraph, not its size, hence length() exists to make things more readable.