fixmint
EN

How to add a free loan calculator to your website

To add a calculator to your website, open the widgets page, pick one, choose its colour and theme, press Copy code and paste the snippet where you want it to appear. It is plain HTML, CSS and JavaScript, so it works in a hand-written page, a WordPress Custom HTML block, a Squarespace Code block or a Wix HTML embed. There is nothing to install and no account to make.

Loan calculatorWhat will this loan cost me?Do it free

Which calculator to pick

There are twelve widgets in four groups: money, everyday numbers, time, and words and passwords. Three suit most finance, health and how-to sites:

  • Loan payment takes an amount, a yearly interest rate and a number of years, and shows the monthly payment and the total interest. With its starting values (25,000 at 6.5% over 5 years) it shows 489.15 a month and 4,349.22 of interest. It uses the standard fixed-payment formula, and with a 0% rate it simply divides the amount by the months. The maths is explained in what a loan costs.
  • Percentage calculator answers the three questions people actually ask: what is 15% of 80, what percent of 48 is 12, and how much did something change from 50 to 65. See how to calculate a percentage for the formulas.
  • BMI calculator takes height and weight in centimetres and kilos, or inches and pounds, and places the result on the adult scale. What BMI measures, and what it misses belongs next to it on the page.

Every widget has a full version as a tool page, such as the loan calculator, the percentage calculator and the BMI calculator. Link to it under the widget for readers who want more room.

How to add it, step by step

  1. Open the widgets page and find the widget in the list.
  2. Pick a colour from the five swatches, or any colour with the last one. Pick a theme: Light, Dark, or Auto, which follows whether the visitor's device is set to light or dark. Your choices are written into the snippet.
  3. Press Copy code.
  4. Open the page you are editing and paste the code at the spot where the calculator should sit.
  5. Save, then open the live page and try it.

The snippet is three parts in a row: a <div> with the calculator, a <style> block and a <script> block. Paste all three together.

Plain HTML, WordPress, Squarespace, Wix and Webflow

Every site builder offers a block that accepts raw HTML. The names differ, the idea does not.

  • Plain HTML: paste inside <body>, where the calculator should show.
  • WordPress: in the block editor add a Custom HTML block and paste. Use the preview tab to see it. On some setups, a multisite network for one, certain users cannot save script tags, and then the calculator's script is lost when they paste.
  • Squarespace: add a Code block and paste. Make sure the block runs the code and does not show it as text.
  • Wix and Webflow: add an Embed element (an HTML embed in Wix) and paste. Some builders place embedded code in a box of fixed size. If the bottom of the calculator is cut off, make the box taller.

Builders change which plans may use custom code or scripts, and the rules move. At the time you build, search the builder's help for "custom code" or "embed". If the calculator appears but does not calculate, view the page source and search for fmw-. If the <script> is missing, the builder removed it.

Why a snippet and not an iframe or someone else's script

An iframe loads a whole second page from another server. That is an extra request, and the other server sees the visitor's address and, usually, the page they came from on every load. A script loaded from another domain is the same, and it runs with full access to your page, in whatever form that domain serves it that day. Either can fail or be blocked, and an iframe has a fixed height you have to guess.

A fixmint widget is its own copy in your page. The snippets here run from 4.1 to 6.0 KB. They load nothing from fixmint, make no network requests of their own, and set no cookies and keep nothing in browser storage. The sums run in the visitor's browser. The only link back is the small "Loan calculator by fixmint" line at the bottom, which is an ordinary link. You may remove it.

The trade-off: a copy does not update itself. If a widget is improved later, you paste the new version.

Change the words, the currency and the colours

Everything the visitor reads is plain English text in the HTML part of the snippet: the title (Monthly loan payment), the labels and the result lines. Edit them, or translate them into your language.

Numbers follow the lang attribute of your page. On a page with lang="de" the same loan shows 489,15, with a decimal comma. To show money with a currency, set data-currency="EUR" (or USD, GBP and so on) on the loan and bill-splitting widgets, and the amounts appear as 489,15 € on a German page or $489.15 on an English one.

Every class in a widget starts with fmw-, so the widget does not touch the rest of your page's styles. It takes your page's font. The colours are CSS variables such as --fmw-accent, which you can override.

Check it on a phone

Open the published page on a real phone, not only a narrow desktop window. A widget is at most 440 px wide and shrinks to fit. The input fields are 44 px tall and ask for a number keyboard. Type into every field, switch your phone between light and dark mode if you chose Auto, and check that nothing is cut off at the bottom.

What a calculator on your page is not

The loan widget works out principal and interest. It leaves out fees, insurance and taxes, so the lender's real figure can differ. Say so near it, and point readers to the difference between APR and interest rate. The calculators are estimates, not an offer or advice.

Looking for the same fixes as commands for your own computer? fixmint's command-line program has twenty of them.

Know someone with the same problem? Send them this article.

Comments

    No comments yet. Be the first.

    Your rating (optional)
    0 / 300

    Your email is never shown or kept.

    Cover of Digital Workflow ToolkitDigital Workflow Toolkit

    Recipes, templates and patterns for chaining small file jobs (convert, rename, compress, merge) into workflows that run the same way every time.

    $19.00Get it on Gumroad