Retirement savings calculator template
The nest egg at retirement from savings, monthly contributions and return, with the income it supports and its value in today's money. Seven inputs, five calculation fields.
Try the live Retirement savings calculator first- Import-ready Gravity Forms JSON
- One-page install guide
- The plugins it needs, with links
- Everything in Template
- Step-by-step PDF with screenshots of every field and formula
- The CSS skin from this site, with notes on matching your brand
What you'll need
Check these before you buy so there are no surprises. Links may be affiliate links.
- Required Gravity Forms (any license) Calculation fields are in core; the exponents and if blocks need GP Advanced Calculations.
- Required GP Advanced Calculations (Gravity Wiz) Exponents, functions and date math in calculation fields. The formulas in this template use its syntax. Part of Gravity Perks; needs the Spellbook plugin active as well.
Free build guide: Retirement savings calculator for WordPress
This guide rebuilds the Retirement savings calculator from this site in Gravity Forms: 8 inputs, 5 live results and no submit button. Expect about 42 minutes by hand. The template above is the same form as an import file, and the bundle adds a PDF version of this guide with a screenshot of every setting, plus the stylesheet.
You will end up with:
- Nest egg at retirement
- Yearly income it supports
- Monthly income
- Nest egg in today's money
- Total you will contribute
What you need
- Gravity Forms (any license) — Calculation fields are in core; the exponents and if blocks need GP Advanced Calculations.
- GP Advanced Calculations (Gravity Wiz) — Exponents, functions and date math in calculation fields. The formulas in this template use its syntax. Part of Gravity Perks; needs the Spellbook plugin active as well.
The formulas below use GP Advanced Calculations syntax: exponents, functions or date math that core calculation fields cannot do. Install and activate it, with its Spellbook parent plugin, before you start; without it every result shows 0.
1. Create the form
- Go to Forms → New Form and name it Retirement savings.
- In Form Settings → Form Layout, set the CSS Class Name to
fo-email-results, and the button text to Email me these results. - Leave the form open in the editor; the fields come next.
2. Add the fields, in this order
Field IDs are assigned as you add fields. If yours come out differently, change the {Label:ID} references in the formulas to match your IDs. Settings not mentioned stay at their defaults.
1. Your age · Number · ID 1
Number Format 9,999.99; Default Value 35; Layout: half width, on the same row as its neighbor (drag the field beside it in the editor; no CSS class needed).
2. Retire at · Number · ID 2
Number Format 9,999.99; Default Value 65; Layout: half width, on the same row as its neighbor (drag the field beside it in the editor; no CSS class needed).
3. Saved so far · Number · ID 3
Number Format Currency; Default Value 50000; Description “All retirement accounts together.”; Layout: half width, on the same row as its neighbor (drag the field beside it in the editor; no CSS class needed).
4. Saving per month · Number · ID 4
Number Format Currency; Default Value 800; Description “Your contributions plus any employer match.”; Layout: half width, on the same row as its neighbor (drag the field beside it in the editor; no CSS class needed).
5. Return (% per year) · Number · ID 5
Number Format 9,999.99; Default Value 7; Description “A stock-heavy mix has averaged about 7% after inflation over long periods; use 4–5% for a balanced one.”; Layout: half width, on the same row as its neighbor (drag the field beside it in the editor; no CSS class needed).
6. Withdrawal rate · Drop Down · ID 6
Layout: half width, on the same row as its neighbor (drag the field beside it in the editor; no CSS class needed).
Choices (tick show values and enter each value):
- 4% a year (the usual rule) — value
4(selected by default) - 3.5% (more cautious) — value
3.5 - 5% (shorter retirement) — value
5
7. Inflation (% per year) · Number · ID 7
Number Format 9,999.99; Default Value 2.5; Description “To show the nest egg in today's money. Set 0 if the return above is already after inflation.”.
8. Nest egg at retirement · Number · ID 8
Number Format Currency; Custom CSS Class (Appearance tab) fo-result; tick Enable Calculation, Rounding 0.
if( {Return:5} == 0 ):
( {Saved:3} + {Monthly:4} * ( ( {Retire:2} - {Age:1} ) * 12 ) )
else:
( {Saved:3} * ( ( 1 + ( {Return:5} / 1200 ) ) ^ ( ( {Retire:2} - {Age:1} ) * 12 ) ) + {Monthly:4} * ( ( ( 1 + ( {Return:5} / 1200 ) ) ^ ( ( {Retire:2} - {Age:1} ) * 12 ) ) - 1 ) / ( {Return:5} / 1200 ) )
endif;
9. Yearly income it supports · Number · ID 9
Number Format Currency; Description “At the withdrawal rate chosen.”; Layout: half width, on the same row as its neighbor (drag the field beside it in the editor; no CSS class needed); Custom CSS Class (Appearance tab) fo-result fo-result--sub; tick Enable Calculation, Rounding 0.
if( {Return:5} == 0 ):
( {Saved:3} + {Monthly:4} * ( ( {Retire:2} - {Age:1} ) * 12 ) ) * {Withdrawal:6} / 100
else:
( {Saved:3} * ( ( 1 + ( {Return:5} / 1200 ) ) ^ ( ( {Retire:2} - {Age:1} ) * 12 ) ) + {Monthly:4} * ( ( ( 1 + ( {Return:5} / 1200 ) ) ^ ( ( {Retire:2} - {Age:1} ) * 12 ) ) - 1 ) / ( {Return:5} / 1200 ) ) * {Withdrawal:6} / 100
endif;
10. Monthly income · Number · ID 10
Number Format Currency; Layout: half width, on the same row as its neighbor (drag the field beside it in the editor; no CSS class needed); Custom CSS Class (Appearance tab) fo-result fo-result--sub; tick Enable Calculation, Rounding 0.
if( {Return:5} == 0 ):
( {Saved:3} + {Monthly:4} * ( ( {Retire:2} - {Age:1} ) * 12 ) ) * {Withdrawal:6} / 1200
else:
( {Saved:3} * ( ( 1 + ( {Return:5} / 1200 ) ) ^ ( ( {Retire:2} - {Age:1} ) * 12 ) ) + {Monthly:4} * ( ( ( 1 + ( {Return:5} / 1200 ) ) ^ ( ( {Retire:2} - {Age:1} ) * 12 ) ) - 1 ) / ( {Return:5} / 1200 ) ) * {Withdrawal:6} / 1200
endif;
11. Nest egg in today's money · Number · ID 11
Number Format Currency; Layout: half width, on the same row as its neighbor (drag the field beside it in the editor; no CSS class needed); Custom CSS Class (Appearance tab) fo-result fo-result--sub; tick Enable Calculation, Rounding 0.
if( {Return:5} == 0 ):
( {Saved:3} + {Monthly:4} * ( ( {Retire:2} - {Age:1} ) * 12 ) ) / ( 1 + {Inflation:7} / 100 ) ^ ( {Retire:2} - {Age:1} )
else:
( {Saved:3} * ( ( 1 + ( {Return:5} / 1200 ) ) ^ ( ( {Retire:2} - {Age:1} ) * 12 ) ) + {Monthly:4} * ( ( ( 1 + ( {Return:5} / 1200 ) ) ^ ( ( {Retire:2} - {Age:1} ) * 12 ) ) - 1 ) / ( {Return:5} / 1200 ) ) / ( 1 + {Inflation:7} / 100 ) ^ ( {Retire:2} - {Age:1} )
endif;
12. Total you will contribute · Number · ID 12
Number Format Currency; Layout: half width, on the same row as its neighbor (drag the field beside it in the editor; no CSS class needed); Custom CSS Class (Appearance tab) fo-result fo-result--sub; tick Enable Calculation, Rounding 0.
{Monthly:4} * ( ( {Retire:2} - {Age:1} ) * 12 )
13. Email me these results · Section · ID 90
Description “One email with the numbers above, plus a link that brings them back.”; Custom CSS Class (Appearance tab) fo-email-results__head.
14. Your email · Email · ID 91
Description “Sent once, to this address only. No list, no follow-up.”; Custom CSS Class (Appearance tab) fo-email-results.
3. Email the results
This form submits once, to email the visitor their numbers. Three settings make it work, and the imported form already has them:
- Notification (Form Settings → Notifications): “Results to the visitor”, sent to the Email field, with the inputs and results as merge tags such as
{Home price:1}and a link back to the page. - Confirmation (Form Settings → Confirmations): type Redirect, to the page the form is on, with a query string that carries every input (
fo1={Home price:1}&fo2=…). Point it at your own page. - Prepopulation: each input has “Allow field to be populated dynamically” on, with the parameter name
foplus its ID, so the redirect fills the form back in and the results reappear.
4. Put it on a page and make it look like this
Add the form to any page with the Gravity Forms block, or the shortcode [gravityform id="X" title="false" ajax="false"]. The form inherits your theme’s styles; the classes you set in step 2 are hooks for the look you see on this site:
fo-resulton a calculation field makes it the big teal result panel.fo-result fo-result--submakes the smaller secondary figures.fo-segmentedon a radio field turns it into a segmented switch.- Two fields on one row is the editor’s own column layout: drag a field beside another and the row splits in half. No CSS class is needed, and the old
gf_left_halfReady Classes are deprecated.
The bundle includes the two stylesheets that implement those classes, with notes on matching your brand colors. Without them the form still works; it just looks like your theme’s default Gravity Forms styling.
How the math works is explained under “How it’s calculated” on the live Retirement savings calculator.