The length of the first and last names

A quicker way to do that is to use describe call in Apex.

System.debug(Contact.FirstName.getDescribe().length); //Prints 40
System.debug(Contact.LastName.getDescribe().length); //Prints 80

It also works for All fields standard and custom.

That being said, you can use global describe to get lengths of all fields.

Src : https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dynamic_describe_objects_understanding.htm


you can check details about fields on Contact SOAP API guide

FirstName - The contact’s first name up to 40 characters.

LastName - Required. Last name of the contact up to 80 characters.