The entity type of every Salesforce record ID is encoded in its first three characters. The ID Field Type is a base-62 encoded string.
18-Character ID Encoding
0 0 0 1 1 2 3 3 3 3 3 3 3 3 3 4 4 4
0 0 0 : the object key prefix unique to the entity type.
1 1 : *Pod Identifier/ Instance Identifier
2 : Reserved for future system use.
3 3 3 3 3 3 3 3 3 : Unique alpha numeric identifier.
4 4 4 : Optional 3 character suffix to make Id's case-insensitive.
15-Character and 18-Character IDs, and Case Sensitivity
Salesforce IDs are often represented by 15-character, base-62, strings.
Each character can be one of 62 possible values:
a lowercase letter (a-z) - 26 values
an uppercase letter (A-Z) - 26 values
a numeric digit (0-9) - 10 values
These 15-character IDs are case-sensitive. To Salesforce, 000000000000Xyz is not the same as 000000000000xYZ.
All API calls return 18-character IDs that are case-safe, meaning that they will be compared correctly by case-insensitive applications. The extra 3 characters at the end of the ID encode the case of the preceding 15 characters. Use 18-character IDs in all API calls when creating, editing, or deleting data.
18-character IDs are case-safe, but not case-insensitive. In other words, if you manually change the case of an 18-character ID, Salesforce detects that the three extra characters do not match the case of the preceding characters and returns an error.
To convert the 18-character ID to a 15-character version, you may truncate the last three characters. However, Salesforce recommends that you use the 18-character ID.
Commonly used Salesforce objects and their "Object Key Prefix"
Resources: