The SSA uses your Average Indexed Monthly Earnings (AIME) and Primary Insurance Amount (PIA) to calculate your benefits. The formula Social Security uses is quite complicated, and most people won’t be interested in trying to calculate their benefits on their own, especially because Social Security can give you an estimate.
the SSA will determine your AIME. To do this, the SSA will adjust, or index, your lifetime earnings to account for the increase in general wages that happened during the years you worked. This is done to make sure that the payments you get in the future mirror this rise.
The SSA will use up to 35 of your working years in the calculation. The SSA takes the years with the highest indexed earnings, adds them together, and divides them by the total number of months for those years. The average is then rounded down to reach your AIME.
You can see an example of how the SSA calculates an AIME on its website.