Most service websites still hide their prices behind a “Request a quote” button. Visitors who are not ready to talk to a salesperson simply leave. A pricing calculator website section fixes that: it gives people a realistic number in a few seconds, and it hands you a pre-qualified lead with the scope already defined.
This guide is a practical, copy-paste tutorial. No frameworks, no plugins, no monthly SaaS fee. Just semantic HTML, around 60 lines of CSS and a small JavaScript file that handles sliders, checkboxes, live totals, currency formatting and passing the result into your contact form.
What We Are Building
The finished widget is a two-column layout (single column on mobile) with:
- A project type selector that sets the base price
- Two range sliders (number of pages, monthly support hours) with live value output
- A group of checkboxes for optional add-ons
- A rush delivery toggle that applies a percentage uplift
- A sticky summary panel with a line-by-line breakdown, a one-off total and a recurring monthly total
- Hidden form fields so the estimate travels with the contact request
Total weight: under 5 KB, no dependencies, works offline, and it passes Core Web Vitals without any extra effort because nothing is loaded from a third party.

Step 0: Define the Pricing Model Before You Write Code
The hardest part of a pricing calculator is not the JavaScript, it is the math. Write your model on paper first. Keep it simple enough that a visitor can follow the logic, but accurate enough that your real quote lands within roughly 15% of the estimate. Otherwise the tool destroys trust instead of building it.
Here is the sample model used in this tutorial. Replace the numbers with your own:
| Project type | Base price | Pages included | Extra page |
|---|---|---|---|
| Landing page | $900 | 1 | n/a |
| Brochure site | $2,400 | 5 | $180 |
| E-commerce store | $6,500 | 8 | $140 |
| Custom web app | $12,000 | 6 | $220 |
Add-ons: SEO setup $600, copywriting $850, multilingual $1,200, booking system $950. Support retainer: $95 per hour, per month. Rush delivery: +25% on the one-off subtotal.
Step 1: The HTML Structure
Use a real <form> element. Native inputs give you keyboard support, mobile-friendly controls and accessibility for free. Note the <output> elements next to each slider and the aria-live="polite" on the summary so screen readers announce the updated total.
<form id="quote-calc" class="calc" action="/contact/" method="post">
<div class="calc__panel">
<div class="calc__field">
<label for="project-type">What do you need?</label>
<select id="project-type" name="project_type">
<option value="landing">Landing page</option>
<option value="brochure" selected>Brochure site</option>
<option value="ecommerce">E-commerce store</option>
<option value="webapp">Custom web app</option>
</select>
</div>
<div class="calc__field">
<label for="pages">Number of pages: <output id="pages-out">8</output></label>
<input type="range" id="pages" name="pages" min="1" max="40" step="1" value="8">
</div>
<div class="calc__field">
<label for="hours">Monthly support hours: <output id="hours-out">0</output></label>
<input type="range" id="hours" name="hours" min="0" max="20" step="1" value="0">
</div>
<fieldset class="calc__field">
<legend>Add-ons</legend>
<label class="calc__check"><input type="checkbox" name="addon" value="seo"> SEO setup</label>
<label class="calc__check"><input type="checkbox" name="addon" value="copy"> Copywriting</label>
<label class="calc__check"><input type="checkbox" name="addon" value="i18n"> Multilingual</label>
<label class="calc__check"><input type="checkbox" name="addon" value="booking"> Booking system</label>
</fieldset>
<div class="calc__field">
<label class="calc__check"><input type="checkbox" id="rush"> Rush delivery (+25%)</label>
</div>
</div>
<aside class="calc__summary" aria-live="polite">
<h3>Your estimate</h3>
<ul id="calc-lines" class="calc__lines"></ul>
<p class="calc__total"><span>One-off total</span> <strong id="calc-total"></strong></p>
<p class="calc__monthly" id="calc-monthly"></p>
<input type="hidden" id="field-estimate" name="estimate_total">
<input type="hidden" id="field-monthly" name="estimate_monthly">
<textarea id="field-summary" name="estimate_summary" hidden></textarea>
<button type="submit" class="calc__cta">Send me this quote</button>
<small>Indicative estimate. Final pricing confirmed after a 20-minute call.</small>
</aside>
</form>

Step 2: The Responsive CSS
CSS Grid handles the layout. One column on phones, two columns from 860px, with a sticky summary on desktop so the total never scrolls out of view. The accent-color property styles the native sliders and checkboxes in one line, which keeps the file tiny.
:root{
--calc-ink:#111827;
--calc-muted:#6b7280;
--calc-accent:#2563eb;
--calc-line:#e5e7eb;
}
.calc{
display:grid;
grid-template-columns:1fr;
gap:24px;
color:var(--calc-ink);
font:16px/1.5 system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
}
@media (min-width:860px){
.calc{grid-template-columns:1.6fr 1fr;align-items:start}
.calc__summary{position:sticky;top:24px}
}
.calc__panel,.calc__summary{
border:1px solid var(--calc-line);
border-radius:14px;
padding:24px;
background:#fff;
}
.calc__field{margin-bottom:22px}
.calc__field > label,.calc__field legend{display:block;font-weight:600;margin-bottom:10px}
.calc__check{display:flex;align-items:center;gap:10px;font-weight:400;margin-bottom:10px;cursor:pointer}
select,input[type=range]{width:100%}
select{padding:12px;border:1px solid var(--calc-line);border-radius:10px;background:#fff}
input[type=range]{height:28px;accent-color:var(--calc-accent)}
input[type=checkbox]{width:20px;height:20px;accent-color:var(--calc-accent)}
.calc__lines{list-style:none;margin:0 0 16px;padding:0;font-size:15px;color:var(--calc-muted)}
.calc__lines li{display:flex;justify-content:space-between;gap:12px;padding:7px 0;border-bottom:1px dashed var(--calc-line)}
.calc__total{display:flex;justify-content:space-between;align-items:baseline;font-size:18px;margin:0 0 6px}
.calc__total strong{font-size:30px;letter-spacing:-.02em}
.calc__monthly{color:var(--calc-muted);font-size:14px;margin:0 0 18px}
.calc__cta{
width:100%;padding:14px 18px;border:0;border-radius:10px;
background:var(--calc-accent);color:#fff;font-size:16px;font-weight:600;cursor:pointer;
}
.calc__cta:hover{filter:brightness(1.08)}
.calc__summary small{display:block;margin-top:10px;color:var(--calc-muted);font-size:12px}
@media (prefers-reduced-motion:no-preference){
.calc__total strong{transition:color .2s ease}
}
Mobile detail that matters
On screens under 860px, move the summary above the fold-out options or add a compact fixed bar at the bottom showing only the total. Users on phones should never have to scroll to find the number they came for. A one-line fix:
@media (max-width:859px){
.calc__summary{position:sticky;bottom:0;z-index:10;box-shadow:0 -6px 20px rgba(0,0,0,.08)}
}
Step 3: The JavaScript Logic
Everything lives in one configuration object so a non-developer can update prices without touching the logic. The script listens to a single input event on the form, which covers sliders, checkboxes and the select at once (event delegation, no listener per field).
(function () {
var form = document.getElementById('quote-calc');
if (!form) return;
var PRICING = {
locale: 'en-US',
currency: 'USD',
base: { landing: 900, brochure: 2400, ecommerce: 6500, webapp: 12000 },
includedPages: { landing: 1, brochure: 5, ecommerce: 8, webapp: 6 },
extraPage: { landing: 0, brochure: 180, ecommerce: 140, webapp: 220 },
addons: { seo: 600, copy: 850, i18n: 1200, booking: 950 },
labels: { seo: 'SEO setup', copy: 'Copywriting', i18n: 'Multilingual', booking: 'Booking system' },
supportHourly: 95,
rushRate: 0.25
};
var money = new Intl.NumberFormat(PRICING.locale, {
style: 'currency',
currency: PRICING.currency,
maximumFractionDigits: 0
});
var $ = function (id) { return document.getElementById(id); };
function readState() {
var select = $('project-type');
return {
type: select.value,
typeLabel: select.options[select.selectedIndex].text,
pages: Number($('pages').value),
hours: Number($('hours').value),
rush: $('rush').checked,
addons: Array.prototype.slice
.call(form.querySelectorAll('input[name="addon"]:checked'))
.map(function (i) { return i.value; })
};
}
function calculate(s) {
var lines = [];
lines.push({ label: s.typeLabel, amount: PRICING.base[s.type] });
var extra = Math.max(0, s.pages - PRICING.includedPages[s.type]);
var pagesCost = extra * PRICING.extraPage[s.type];
if (pagesCost > 0) {
lines.push({ label: extra + ' extra page' + (extra > 1 ? 's' : ''), amount: pagesCost });
}
s.addons.forEach(function (key) {
lines.push({ label: PRICING.labels[key], amount: PRICING.addons[key] });
});
var subtotal = lines.reduce(function (sum, l) { return sum + l.amount; }, 0);
if (s.rush) {
var fee = Math.round(subtotal * PRICING.rushRate);
lines.push({ label: 'Rush delivery', amount: fee });
subtotal += fee;
}
return { lines: lines, oneOff: subtotal, monthly: s.hours * PRICING.supportHourly };
}
function buildSummaryText(s, r) {
var rows = r.lines.map(function (l) { return '- ' + l.label + ': ' + money.format(l.amount); });
rows.unshift('Project: ' + s.typeLabel + ' / ' + s.pages + ' pages');
rows.push('One-off total: ' + money.format(r.oneOff));
if (r.monthly > 0) rows.push('Monthly support: ' + money.format(r.monthly));
return rows.join('\n');
}
function render() {
var s = readState();
var r = calculate(s);
$('pages-out').textContent = s.pages;
$('hours-out').textContent = s.hours;
$('calc-lines').innerHTML = r.lines.map(function (l) {
return '<li><span>' + l.label + '</span><span>' + money.format(l.amount) + '</span></li>';
}).join('');
$('calc-total').textContent = money.format(r.oneOff);
$('calc-monthly').textContent = r.monthly > 0
? 'Plus ' + money.format(r.monthly) + ' per month for support'
: 'No support retainer selected';
$('field-estimate').value = money.format(r.oneOff);
$('field-monthly').value = money.format(r.monthly);
$('field-summary').value = buildSummaryText(s, r);
}
form.addEventListener('input', render);
form.addEventListener('change', render);
render();
})();
Why Intl.NumberFormat instead of toFixed(2)
Hand-rolled formatting breaks the moment you sell outside your home country. Intl.NumberFormat is built into every modern browser and handles thousands separators, symbol position and decimal conventions automatically:
| Locale / currency | Output for 12450 |
|---|---|
| en-US / USD | $12,450 |
| en-GB / GBP | £12,450 |
| fr-FR / EUR | 12 450 € |
| de-CH / CHF | CHF 12’450 |
To support several currencies, store a rate table and rebuild the formatter when the visitor switches currency. Create the formatter once per currency and reuse it: instantiating Intl.NumberFormat inside a loop is one of the most common performance mistakes in calculator widgets.
Step 4: Pass the Result to Your Contact Form
A calculator that does not capture the lead is just entertainment. You have three reliable options.
Option A: Hidden fields in the same form (simplest)
Already done in the markup above. The three hidden fields (estimate_total, estimate_monthly, estimate_summary) are submitted alongside the name and email fields you add to the summary panel. Your form handler or email notification receives the full breakdown as plain text.
Option B: Send the visitor to a separate contact page
form.addEventListener('submit', function (e) {
e.preventDefault();
var s = readState();
var r = calculate(s);
var params = new URLSearchParams({
type: s.type,
pages: s.pages,
hours: s.hours,
addons: s.addons.join(','),
total: r.oneOff
});
window.location.href = '/contact/?' + params.toString();
});
On the contact page, read the values and prefill a textarea:
var q = new URLSearchParams(window.location.search);
if (q.has('total')) {
document.getElementById('message').value =
'I used your pricing calculator. Estimated budget: ' + q.get('total') +
' for a ' + q.get('type') + ' project (' + q.get('pages') + ' pages).';
}
Option C: sessionStorage handoff
Cleaner URLs, and nothing sensitive sits in analytics referrer data:
sessionStorage.setItem('quote', JSON.stringify({ state: s, result: r }));
// then on the contact page
var saved = JSON.parse(sessionStorage.getItem('quote') || 'null');
Security note: every value above comes from the browser and can be edited by anyone. Treat the estimate as a lead attribute, never as a payable amount. If the calculator feeds a checkout, recalculate the price server side from the raw selections.

Step 5: Track It So You Know If It Works
Push an event when a visitor interacts and when they submit. In GA4 via a data layer:
var tracked = false;
form.addEventListener('input', function () {
if (tracked) return;
tracked = true;
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ event: 'calculator_start' });
});
form.addEventListener('submit', function () {
var r = calculate(readState());
window.dataLayer.push({ event: 'calculator_submit', estimate_value: r.oneOff });
});
The two metrics to watch: start rate (visitors who touch a slider) and completion rate (starts that submit). A healthy pricing calculator on a service website converts between 8% and 20% of users who start it. If starts are high but submissions are low, your numbers are probably scaring people, or your form asks for too much.
Accessibility and UX Checklist
- Every input has a real
<label>linked byforor wrapping the control. - The summary container uses
aria-live="polite"so updates are announced once, not on every keystroke. - Sliders are operable with arrow keys (native behaviour, do not replace them with div-based sliders).
- Touch targets are at least 44×44 pixels.
- Contrast ratio of at least 4.5:1 on the total and the disclaimer text.
- The calculator renders with sensible defaults before JavaScript runs, so nothing looks broken on slow connections.
- Show a range (“$4,200 to $5,100”) rather than a single number if your real-world variance is high.

Build It Yourself or Use a Hosted Tool?
| Criteria | Custom HTML/CSS/JS | Hosted calculator builder |
|---|---|---|
| Setup time | 1 to 3 hours | 20 to 40 minutes |
| Recurring cost | $0 | $15 to $90 per month |
| Page speed impact | Under 5 KB inline | iframe plus 100 to 400 KB of scripts |
| SEO value | Content is in your HTML and indexable | Often inside an iframe, little to no SEO value |
| Design control | Total | Limited to the builder theme |
| Complex formulas, PDF export, payments | You build it | Included |
If your model fits on one page of notes, build it. If you need conditional logic trees, saved quotes, e-signature and payment capture, a hosted builder earns its fee.
Five Mistakes That Kill Calculator Conversions
- Asking for an email before showing the price. Show the number first, then offer to send a detailed PDF breakdown.
- Too many fields. Four to six inputs is the sweet spot. Everything else belongs in the discovery call.
- No disclaimer. One line (“Indicative estimate, final pricing confirmed after a short call”) protects you and reassures the visitor.
- Totals that jump without feedback. Keep the summary visible at all times so cause and effect are obvious.
- Prices hardcoded in ten places. Keep a single config object so updating rates takes 30 seconds.
FAQ
How long does it take to add a pricing calculator to a website?
Using the code in this tutorial, around one to three hours including styling and testing. Most of that time goes into defining the pricing model, not the code.
Will showing prices on my website scare clients away?
It filters them. Visitors with a budget far below your range disqualify themselves, which saves you proposal time. Prospects in range arrive at the call already anchored on your numbers, and those calls close faster.
Can I use this calculator in WordPress without a plugin?
Yes. Paste the HTML into a Custom HTML block, put the CSS in Appearance > Customize > Additional CSS (or your child theme stylesheet) and load the JavaScript from a small file enqueued in your theme. No plugin required and nothing extra to maintain.
Does a pricing calculator help SEO?
Indirectly but significantly. It increases time on page, reduces pogo-sticking back to the results, earns links from roundups of free tools, and gives you a page that can rank for “cost”, “price” and “calculator” queries in your niche. Keep it in your own HTML rather than an iframe so search engines can read the surrounding content.
How do I handle multiple currencies?
Store your prices in a single base currency, keep a conversion rate table, and swap the Intl.NumberFormat instance when the visitor changes currency. Round converted values to clean numbers so the output does not look machine-generated.
Should the estimate be a single number or a range?
Use a range when your real quotes vary by more than 15% from the calculator output. A range sets expectations honestly and removes the risk of a client holding you to an exact figure produced by a slider.
How do I stop people from tampering with the total?
Assume they will. Send the raw selections (project type, pages, add-ons) along with the displayed total, and recalculate server side before any invoice or payment is created.
Next Steps
Drop the three snippets into a test page, replace the numbers in the PRICING object with your own rates, and publish it on a dedicated URL such as /pricing-calculator/. Link it from your navigation, your services pages and your email signature. Then watch the start and submit events for a month: the data will tell you exactly which option visitors want, and that is information no competitor on page one of Google can see about your business.
