Embed a live economic chart on your website

Free, self-updating charts of US inflation, interest rates, jobs, housing and more. Choose a chart, preview it, copy the code.

Build your embed code

Pick a chart and the options, check the live preview, then copy the code into any HTML page, blog post or sidebar. There is nothing to install and no account to create.

Initial range
Width
Colors
Shade recessions

Preview

Free for personal and commercial sites. The only condition: leave the two credit links in the code visible. All settings are explained below.

Adding the code to your site

Paste the code wherever your platform accepts raw HTML. The chart sizes itself to the column it is placed in.

  • WordPress: add a Custom HTML block (block editor) or use the Text tab (classic editor). For a sidebar, add a Custom HTML widget and choose the Sidebar width.
  • Blogger: switch the post editor to HTML view, or add an HTML/JavaScript gadget in Layout for a sidebar chart.
  • Squarespace: add a Code block and leave “Display source” off.
  • Wix: add Embed HTML (Embed code › Embed HTML) and size the box to about 640 × 460 px, or 340 × 400 for the sidebar width.
  • Ghost: insert an HTML card.
  • Plain HTML: paste it anywhere inside <body>.

Here is what the code looks like:

<div class="cw-chart" data-series="gas-prices" data-range="5y">
  <a href="https://chartwidgets.com/charts/gas-prices.html">Full history and data</a> at
  <a href="https://chartwidgets.com/">ChartWidgets</a>
</div>
<script src="https://chartwidgets.com/widgets/chart.js" async></script>

The <div> is a placeholder that holds the settings and the credit links; the script finds every placeholder on the page and draws a chart in it. Want three charts in one article? Add three placeholders and keep a single script tag.

Settings you can change

AttributeAccepted valuesEffect
data-serieschart id (table below)Which indicator is drawn.
data-range1y · 5y · 10y · 20y · maxTime span shown when the page loads (20y if omitted, 5y for compact; a series with less than 20 years of data opens on max). Readers can still change it.
data-sizefull · compactFull width adapts to your column up to 840 px; compact is up to 340 px for sidebars.
data-themelight · dark · autoColor scheme; auto matches the visitor’s system setting.
data-recessionson · offShow or hide the grey recession bands.

Technical details

  • One small script (about 7 KB compressed), loaded asynchronously so it never delays your page.
  • Charts are drawn as SVG inside a Shadow DOM: your stylesheet can’t distort them, and theirs can’t leak into your page.
  • No cookies, no tracking, no third-party requests – just one small data file per chart.
  • The data refreshes automatically whenever the source agency publishes a new figure; you never need to update the code.
  • If a chart id is wrong or the data can’t load, the placeholder shows a short notice and the links remain.

Chart ids

data-seriesChartGroup
fed-funds-rateFederal Funds RateInterest rates
10-year-treasury-yield10-Year Treasury YieldInterest rates
2-year-treasury-yield2-Year Treasury YieldInterest rates
5-year-treasury-yield5-Year Treasury YieldInterest rates
1-year-treasury-yield1-Year Treasury YieldInterest rates
30-year-treasury-yield30-Year Treasury YieldInterest rates
3-month-treasury-bill3-Month Treasury Bill RateInterest rates
yield-curveYield Curve (10Y − 2Y)Interest rates
yield-curve-10y-3mYield Curve (10Y − 3M)Interest rates
prime-ratePrime RateInterest rates
real-interest-rateReal Interest Rate (10-Year TIPS)Interest rates
inflation-expectationsInflation Expectations (10-Year)Interest rates
5-year-breakeven-inflation5-Year Breakeven Inflation RateInterest rates
5y5y-forward-inflation5-Year, 5-Year Forward Inflation ExpectationInterest rates
mortgage-rates30-Year Mortgage RateInterest rates
inflation-rateUS Inflation RateInflation
core-inflation-rateCore Inflation RateInflation
pce-inflationPCE Inflation RateInflation
core-pce-inflationCore PCE Inflation RateInflation
ppi-inflationPPI Inflation RateInflation
shelter-inflationShelter InflationInflation
grocery-inflationGrocery Inflation (Food at Home)Inflation
energy-inflationEnergy InflationInflation
used-car-pricesUsed Car Price InflationInflation
car-insurance-inflationCar Insurance InflationInflation
unemployment-rateUS Unemployment RateJobs and growth
job-growthUS Job GrowthJobs and growth
wage-growthUS Wage GrowthJobs and growth
gdp-growthUS GDP GrowthJobs and growth
us-gdpUS GDPJobs and growth
real-gdpUS Real GDPJobs and growth
misery-indexMisery IndexJobs and growth
personal-saving-ratePersonal Saving RateJobs and growth
retail-sales-growthRetail Sales GrowthJobs and growth
industrial-productionIndustrial Production GrowthJobs and growth
jobless-claimsInitial Jobless ClaimsJobs and growth
job-openingsJob Openings (JOLTS)Jobs and growth
labor-force-participationLabor Force Participation RateJobs and growth
sahm-ruleSahm Rule Recession IndicatorJobs and growth
u6-unemployment-rateU-6 Unemployment RateJobs and growth
quits-rateQuits Rate (JOLTS)Jobs and growth
layoffs-rateLayoffs Rate (JOLTS)Jobs and growth
recession-probabilityRecession ProbabilityJobs and growth
housing-startsHousing StartsHousing
new-home-salesNew Home SalesHousing
new-home-supplyNew Home Supply (Months' Supply)Housing
home-price-growthUS Home Price GrowthHousing
gas-pricesUS Gas PricesFood and energy
oil-pricesCrude Oil Prices (WTI)Food and energy
brent-oil-pricesBrent Crude Oil PricesFood and energy
diesel-pricesUS Diesel PricesFood and energy
natural-gas-pricesNatural Gas Prices (Henry Hub)Food and energy
electricity-pricesUS Electricity PricesFood and energy
egg-pricesUS Egg PricesFood and energy
ground-beef-pricesGround Beef PricesFood and energy
coffee-pricesCoffee PricesFood and energy
bread-pricesBread PricesFood and energy
m2-money-supplyM2 Money SupplyMoney and debt
m1-money-supplyM1 Money SupplyMoney and debt
national-debtUS National DebtMoney and debt
federal-deficitUS Federal DeficitMoney and debt
debt-to-gdpUS Debt to GDPMoney and debt
interest-on-debtFederal Interest PaymentsMoney and debt
fed-balance-sheetFed Balance SheetMoney and debt
us-dollar-indexUS Dollar Index (Broad)Money and debt

Terms of use

You may embed any chart on any website, commercial or not, free of charge and without registration. We only ask that the two credit links in the embed code stay visible and unchanged. The government statistics themselves are in the public domain; the mortgage rate series is © Freddie Mac and must keep its attribution. Please read the disclaimer, and write to support@chartwidgets.com with questions or ideas for new charts.

Questions

Is it really free?

Yes, for personal and commercial websites alike. The only condition is that the two credit links in the code stay visible.

Will the chart keep updating?

Yes. The script loads the latest data file every time a visitor opens your page, so the chart shows new releases without any change to your code.

Can I put several charts on one page?

Yes. Add one placeholder <div> per chart and include the script tag once.