Skip to main content

Coding for (Social) Security

·1600 words·8 mins
By 
DrProton
Table of Contents
Retirement Finances - This article is part of a series.
Part 1: This Article
I only dabble in financial planning, I’m certainly no expert at it. You should NOT make any major decisions based on this post or the software described therein!

As mentioned in Surprise! You’re Retired, one of the things that you’ll want to do soon after a surprise retirement (or preferably well before a planned retirement) is to come up with a strategy for when to claim Social Security benefits.

There are many possible scenarios and situations regarding Social Security, and everybody’s situation is unique. The Social Security rules are complex enough that I wrote some software to help me decide on a strategy to maximize Social Security benefits. This post describes what I learned about Social Security for this project, and also the software itself. While the software is customized to a particular Social Security situation and strategy, there is perhaps a chance that it may be useful to others in similar situations.

Social Security Basics

For Social Security you have a full retirement age (FRA) based on the year of your birth, probably 67. The folks at the Social Security Administration (SSA) have been keeping track of your work record - how much money you’ve made over the years. Based on your work record, you have a dollar amount that is your benefit at FRA, also called your Primary Insurance Amount (PIA), which is how much money you will receive from Social Security each month if you retire when you reach your FRA. More income on your work record means a larger PIA. You can go to the Social Security Administration website to find out your FRA and your PIA.

You get to decide when to start receiving (“claim”) your Social Security benefits, which can be as early as age 62 or as late as age 70. If you claim before your FRA, your monthly benefit is reduced according to a formula, and if you wait to start receiving benefits until after your FRA, your monthly benefits are increased according to a similar formula.

So it’s a tradeoff - you can claim sooner and get a smaller amount each month but for a longer time, or wait and claim later to get a larger amount each month but over a smaller number of years until you die. The Social Security website will show you what your benefit will be as a function of your age when you first claim benefits. There are many calculators out there on other websites that will illustrate the tradeoffs here, and financial planners and advisors are eager to help for a fee.

If the name of the game is to maximize the total amount that you get from Social Security before you die, the best strategy depends on how long you live, which of course you don’t know. If you are in poor health you should claim as early as possible. Or if you have no other savings to draw from and you need the Social Security income just to make ends meet, you have little choice but to claim as early as possible.

There are more Social Security rules that apply to married couples. A spouse can claim benefits either based on their own work record, or on the work record of the other spouse, called spousal benefits. Spousal benefits can be up to 50% of the other spouse’s PIA. If you are married, the name of the game may be to maximize the total benefits received by both you and your spouse, not just to maximize the benefits that each spouse can individually receive.

Split Strategy

There is an interesting possibility for married couples to maximize their total benefit from Social Security sometimes called the split strategy. This strategy works particularly well when one spouse (the Higher Earner) has earned much more income over his/her career than the other (Lower Earner) spouse. In this strategy the ‘split’ is that the Lower Earner generally claims (reduced) Social Security benefits as early as possible and the Higher Earner waits to claim (increased) benefits later. When the Higher Earner spouse claims benefits, the Lower Earner can switch to claiming spousal benefits on the Higher Earner’s work record. Even with the Lower Earner’s spousal benefit being capped at a maximum of 50% of the Higher Earner’s benefit, it may still be higher than the benefit based on the Lower Earner’s work record.

The Social Security Split Strategy Web App

I generally don’t enjoy thinking about financial matters. When I have to make financial decisions, I sometimes have to utilize tricks to get myself to spend time on it. Like writing some software to help with the decision making.

With liberal use of Vibe Coding, I created this Social Security Split Strategy web app to help me analyze the particular split strategy situation that was relevant for me. The app implements the Social Security rules as I understand them, and also has additional ‘situational’ assumptions coded into the app. The app itself is written in TypeScript and uses the React framework.

The Social Security Split Strategy App

The inputs are the monthly benefits at FRA (the PIAs) for both the Lower and Higher Earner spouses. The chart on the left shows the total combined Social Security monthly payment amount as a function of age, which is assumed to be the same for both spouses. The chart on the right shows the total accumulated amount received by both spouses from Social Security, again as a function of age.

While the Lower Earner is always assumed to claim benefits at age 62, the different lines on the chart represent different strategies for the age when the Higher Earner claims benefits, each line is controlled by a checkbox in the Claiming Strategies section. The blue line for Age 62 does not really represent a split strategy, as both the Lower and Higher Earners claim benefits at the same time. In the strategy for age 62, the monthly benefits are significantly reduced and stay constant through the years, but they start accumulating earlier. The other lines that are initially checked on show the situations when the Higher Earner claims benefits at age 65, 67, or 70.

As can be seen on the left chart, for the split strategies the Lower Earner spouse gets a relatively small benefit each month until the Higher Earner claims benefits, at which point the monthly payment jumps up to the amount that the couple will receive from there on out.

On the cumulative graph on the right, the different claiming ages for the Higher Earner result in different total amounts received from Social Security as a function of age. Delaying claiming benefits increases the benefit amount, so if you live long enough, the cumulative amounts for the delayed benefits will catch up to and cross over the cumulative amounts for claiming at earlier ages. In the app, if you uncheck checkboxes so that only 62 and 67 is checked, you can more clearly see the crossover point where the High Earner delaying benefits until FRA will pay more total money - it is near age 78 for the default case. So if both spouses live past age 78, they are money ahead by having the Higher Earner delay claiming benefits until age 67 instead of claiming at 62.

The Report button will bring up a screen that provides the details of the monthly benefit calculation for each checked age strategy.

Results

So what did I decide by running this app? Well, to me the Higher Earner delaying to age 70 didn’t seem worthwhile. The crossover point between the Age 70 and Age 67 lines is not until age 85, and even after age 85 the difference in total accumulated benefits between the two strategies is not dramatic. So eliminate 70, and with it the ages between 67 and 70. Of the ages between 62 and 67 that were left, none really stood out as a clear optimum. They just show a steady tradeoff between getting more per month later versus getting less per month sooner. I would have thought that waiting until FRA might be the ‘winner’, but age 67 does not really stand out on the graphs.

Honestly, the results made me think more seriously about some internet pundits who say that it is ALWAYS better to claim early, even if you don’t need the money for living expenses. The idea is that getting Social Security earlier means that you can keep your invested money invested longer without drawing it down, and historically the investments can provide as much (perhaps more) long-term return as could be obtained by delaying claiming. That and I think there is some validity to the ‘immediate gratification’, spend-it-while-you-can-still-enjoy-it argument that the pundits make.

One other important point to consider: this chart implicitly assumes that both spouses will live to a ripe old age. Obviously the lines will change if one spouse dies, at which point the surviving spouse receives the benefits of the Higher Earner from there on out. So another reason for the Higher Earner to delay claiming would be to increase the survivor benefits of the Lower Earner spouse should the Higher Earner pass away first.

Summary

Writing this software did acheive the goal of keeping me interested enough in financial planning to actually spend quality time doing it. I am certainly more knowledgable now about Social Security policy and rules than I was before. Nevertheless, as mentioned at the top, you should not make any major decisions based on this post or the software! I might urge you to write your own, better retirement planning software instead.

Author
DrProton
Mostly-retired Software Engineer, ex-Physicist, and lifelong learner.

Tags

Retirement Coding Projects Social Security Financial Planning TypeScript React Retirement Planning Web Development Vibe Coding
Retirement Finances - This article is part of a series.
Part 1: This Article

Related

Stretching a Rope
·1249 words·6 mins
By 
DrProton
Coding Projects Physics AI
The Earth Moved, And So Did the Code (to the Web!)
··2002 words·10 mins
By 
DrProton
Coding Projects Physics
Start a Blog!
·1838 words·9 mins
By 
DrProton
Projects Coding
Surprise! You're Retired
·1169 words·6 mins
By 
DrProton
Retirement
AI Sloppiness
·2044 words·10 mins
By 
DrProton
AI Projects