Computing Social Security Income

Last updated: May 25, 2023

I’ve been wanting to code up a tool to compute social security income for quite some time now, and I finally made some significant progress on that front!

To build this tool, I had to gather all the relevant steps and calculations from across various and third-party sites – which was not trivial.

So, the objective of this post is to have every calculation and table needed to compute standard social security income, which the Social Security Administration (SSA) refers to as retirement insurance benefits (RIB), in a single page. 

Maybe for the first time in the history of humanity? Probably not. But if it does exist somewhere, I couldn’t find it. Perhaps the closest was this article, but it left out plenty of important details for actually doing the computation. 

But if you know of another page like this, let me know! Especially if that source provides definitive precision values for each computation step – not easy to find!

Note that I’m sticking to standard social security income here – nothing fancy like spousal benefits, disability benefits, etc. We’ll save those for a future post.

Alrighty, let’s go! 

Determine if Minimum Credits Obtained

To kick things off, first you have to determine if you’re even eligible for social security income, also known as being “fully insured”. 

To be eligible, you need to have 40 credits. After that, you’re golden.

These credits are sometimes referred to as a “quarter of coverage” (QC), because “before 1978, an individual generally was credited with a quarter of coverage for each quarter in which wages of $50 or more were paid”. But after 1978, they switched to using total annual earnings instead of this funky quarterly system. So the QC term is just a holdover term from a by-gone era.

So how do you earn a credit?

Well in 1978, “the law provided that a quarter of coverage be credited for each $250 of an individual’s total wages and self-employment income for calendar year 1978 (up to a maximum of 4 quarters of coverage for the year).”

But it’s not 1978 anymore! Thus, “the amount of earnings needed for a quarter of coverage changes automatically each year with changes in the national average wage index.”

So, you can earn a maximum of four credits a year, and how many credits you earn depends on your earned income that year and the cost of the credits that year (which increases with inflation over time). 

Cost of Credits

Below is a table from providing the cost of a credit for each year from 1978 to 2023.

YearEarnings ($)YearEarnings ($)YearEarnings ($)

You could also compute these table values using the 1978 value and the national average wage index, but it’s easy enough to just pull the values from this (relatively small) table. 

Your Earnings History

The easiest way to get your earnings history is to create an account at the social security administration site, where it will provide a table of all your earned income for your entire career.

The SSA site will also tell you if you’ve hit 40 credits or not yet – very convenient! 

The SSA tool also provides some limited capabilities for estimating your future RIB for different scenarios, if you haven’t already started. But of course I want to do much deeper analysis (especially with regards to FIRE scenarios), which is why I’m going through all the effort to build this tool. 

Determine Taxable Income

Now if you’re getting your earnings history from the SSA site, it’s already providing you with your taxable income for social security purposes. Easy.

But if you’re getting those values from your own records, and you’ve earned an above average income at any point in your career, you’ll need to determine if you were over the maximum taxable income for any year. 

If so, you’ll need to change your income to that maximum value, also referred to as the “contribution and benefit base” (CBB), for all the subsequent calculations. That’s because that max value was the amount of income you paid social security taxes for that year.

The max taxable income for each year from 1937 to 2023 is provided in the table below, available on

YearMax Taxable Income ($)YearMax Taxable Income ($)YearMax Taxable Income ($)

Adjust Income For Inflation

Next up we need to adjust your historical earnings for inflation.

The SSA uses something called the Average Wage Index (AWI) to do this inflation adjustment. 

First, compute the year you turned 60. Easy. 

Then pick out the AWI for the year you turned 60 (sometimes referred to as your “AWI base”) using the table below, available on

YearAWI ($)YearAWI ($)YearAWI ($)

Note: if you turned 60 after 2021, then here in 2023 you’re not yet 62, the earliest you can receive RIB. Computing future estimates of RIB I’ll be discussing in a future post. 

For each year of earnings before you turned 60, do the following:

  • Divide your “Age 60” AWI value by the AWI value for that previous year. The SSA also refers to this ratio as an “index factor”. Round this value to the 7th digit place after the decimal, because that is the precision reported by this tool that generates factors. I’m not sure if that’s 100% correct, since I could not find anything definitive about how many decimals to retain (which is overlooked far too often), but hopefully it’s good enough. 
  • Multiply this ratio/factor by your earnings for that year, to get your inflation-adjusted earnings. Round this result to the nearest cent.

Note: for the year you turned 60 and all subsequent years, the factor is always 1. Now you might initially think that’s a terrible rip-off: you’re not getting your earnings from your 60’s adjusted for inflation! WTF! But don’t worry – you’ll be getting Cost Of Living Adjustments (COLA) in a subsequent step.

Compute Average Indexed Monthly Earnings (AIME)

Now that we have all your inflation-adjusted earnings, it’s time to compute your Average Indexed Monthly Earnings (AIME).

Fortunately this step is pretty easy. Just add up the inflation-adjusted earnings of the 35 years with the highest values, and divide by 420 (the number of months in 35 years). 

Note that this will include plenty of zeros if you FIRE and never earn another dime. 

Truncate the resulting AIME value down to the lower dollar amount

Compute Primary Insurance Amount (PIA)

Next up is computing the Primary Insurance Amount (PIA), which is probably the term you’ll hear the second-most when discussing social security payments (after the main payment itself). 

First, compute the year you turned 62. Easy. 

Again note that if you’re not turning 62 this year or earlier, you’re not yet eligible to receive RIB. Computing future estimates of RIB I’ll be discussing in a future post. 

Next you’ll find the two “bend point” values for the year you turned 62 (even if you’re not starting RIB at age 62). Use the table below, available on

YearBend Point 1 ($)Bend Point 2 ($)YearBend Point 1 ($)Bend Point 2 ($)

Note: these bend points are all just the 1979 bend points of $180 and $1,085 mapped forward in time using the AWI.

Now we can compute your PIA, using these bend points and your AIME. 

If your AIME is less than (or equal to) the first bend point:

PIA = 0.9 * AIME

If your AIME is between the first bend point and the second bend point (or equal to either bend point):

PIA = 0.9 * Bend Point 1 + 0.32 * (AIME – Bend Point 1)

If your AIME is greater than the second bend point:

PIA = 0.9 * Bend Point 1 + 0.32 * (Bend Point 2 – Bend Point 1) + 0.15 * (AIME – Bend Point 2)

Finally, truncate the PIA down to the lower dime

Cost of Living Adjustments (COLA)

Remember how I said not to panic about inflation earlier? Well now we’ll finally do the Cost of Living Adjustments (COLA)!

First, compute the year you turned 62. Easy. 

Next we’ll apply COLA to your PIA, from the year you turned 62 to the current year. 

For each of those years, pull the COLA value from the table below, available on

YearCOLA (%)YearCOLA (%)YearCOLA (%)
19799.91999 a2.520191.6

For each one of those years from age 62 to the current year, do the following:

  1. Multiply the PIA (which includes any COLA adjustments from previous years) by the COLA for that year: New PIA = Previous Year PIA * (1 + COLA/100)
  1. Truncate the new PIA down the next lower dime. Note: this truncation must be done for each year, and should not be done simply after all COLA are applied.

Determine Full Retirement Age (FRA)

Now we need to determine your Full Retirement Age (FRA), also sometimes called the Normal Retirement Age (NRA). 

If you decide to start your social security income at this age, your RIB will match your PIA. Pretty straightforward.

Your FRA depends on what year you were born. See the table below, available on

Birth YearFull Retirement Age
1937 and prior65
193865 and 2 months
193965 and 4 months
194065 and 6 months
194165 and 8 months
194265 and 10 months
195566 and 2 months
195666 and 4 months
195766 and 6 months
195866 and 8 months
195966 and 10 months
1960 and later67

There’s also a quirky little exception for people born on January 1 described on that page. Weird. 

Early / Delayed Retirement Adjustment

But what if you don’t want to start your social security income (RIB) at exactly your FRA?

Fortunately the SSA lays out pretty clearly how your RIB is decreased or increased.

If you want to start RIB 36 months (3 years) or less before your FRA:

RIB = PIA * (1 – (5/9) * 0.01 * Number of Months Early)

If you want to start RIB more than 36 months before your FRA (maximum is 60 months if your FRA is 67, since earliest age you can start RIB is 62):

RIB = PIA * (1 – 0.2 – (5/12) * 0.01 * (Number of Months Early – 36))

If you want to start RIB after your FRA (maximum is 36 months if your FRA is 67, since latest age you can start RIB is 70):

RIB = PIA * (1 + (2/3) * 0.01 * Number of Months Later)

Note: the equation above for starting RIB after your FRA assumes you were born in 1943 or later. If not, divide the delayed retirement credit per year in the table provided by to determine how much each additional month will increase your RIB.

You can also use this overly complicated table provided by the SSA to check the value you got from the above equations. 

Final Truncation

Finally, after all the above math, you just need to truncate the result to the next lower dollar amount. That’s the amount you’ll get from the SSA each month.


Below are a couple of diagrams visualizing the above steps. Initially I tried to put it into a single slide, but you can easily see how crazy that would have been.

Examples and Testing

Of course any time you build a new tool or model, it’s vitally important to test it.

My first two test cases were straight from the SSA site: Case A and Case B.

And fortunately I was able to perfectly match the values provided at every step. And I was able to determine/confirm the required precision needed at each step by comparing my values to those provided in the page. 

I’m very glad they provide these examples. 

There’s a lot more testing I want to do though. There are numerous calculators provided by the SSA and many, many, many, many, many, many, many, many, many, many, many, many, many others that I’d like to compare my tool to. 

I also happen to know some folks that are either taking social security income now or could take it now (but are currently waiting), so I’d like to get their values and confirm I get the same income generated by the SSA. 


In the end it took about 500 lines of Python code to compute just this most standard social security income. Nothing fancy like spousal benefits, disability benefits, etc. 

I’ve placed the code in the EYFI github repo, which you’re welcome to download and run yourself if you’d like to plug in your own values or just play around with different inputs.

You can also run the embedded Python interpreter below. Modify the user inputs section at the top as desired, then hit the Run/Play (sideways triangle) button to generate the plots. To go back to the script to make any changes, hit the Pencil icon. If you want the text larger, hit the hamburger menu button, then scroll to the bottom to see larger font options. In that same menu you can also Full Screen the window, and other actions.

Analysis Questions and Future Work

Now that I have a tool that can compute social security income, and which I can fully automate and control via Python (unlike every other calculator listed above), there are a TON of really interesting questions and analysis I’d like to pursue. And additional capabilities to build as well. 

The biggest questions I’d like to answer are:

  1. When is the optimal time to take social security? Is it really best to wait until age 70 as so many social security advisors and pundits recommend? What about the ROI on the earnings you’ll get if you take social security earlier?
  1. If you have a spouse, how does that change the optimal timing? It looks like spousal benefits are based on PIA, so taking RIB early or late might not have an impact on spousal benefits – but I want to verify.
  1. How are social security benefits impacted by FIRE? And how much more social security can you expect to get if you fall victim to the “one more year” syndrome? What if you start a business after FIRE?
  1. Maybe: what happens if the trust fund reserves are exhausted in 2037 and we only receive 76% of our nominal benefits? How does that impact the decision process?

To answer these questions, I’m also going to need to build the ability to generate future RIB estimates. Hopefully that will be reasonably straightforward, especially if I keep everything in present day dollars (so no inflation factors will be involved).

I’ve also read that the Open Social Security calculator takes into account actuarial values for probability of death each year when delivering a recommendation on when to start social security – I’d love to replicate that if possible, and perhaps explore further questions I have. 

Lots more to do!

It’s funny how social security is one of those topics that people really care about (as they should), and yet is so surprisingly complex that most people quickly shut down when faced with trying to figure it all out. Hopefully this post providing every step gives you a better sense of the overall calculation, and demystifies it at least a little.

If you have any particular burning social security questions, let me know!

Leave a Comment

Your email address will not be published. Required fields are marked *