Most small business owners have no idea what a website costs. They've heard "$500" from a nephew and "$15,000" from an agency, and they don't know which one…

Most small business owners have no idea what a website costs. They've heard "$500" from a nephew and "$15,000" from an agency, and they don't know which one applies to them. A simple cost calculator on your site answers that question before the first call, filters out people who can't afford you, and gives the ones who can a reason to get in touch. This post builds one in vanilla JavaScript: no framework, no build step, about 90 lines split into pricing logic and UI.

The interesting part isn't the code, it's the pricing model behind it. Short answer: keep the pricing rules in a small, pure function that takes the options (pages, features, copywriting, care plan) and returns line items plus a low and high range. Keep the UI separate: read a form with FormData, call the function on every input event, format money with Intl. NumberFormat, and render the result into an element. Show a range, not a single number, and say the final quote follows a call.

Start with the pricing model Before writing code, decide what actually changes your price. For most small business sites it's a short list: A base price for design, setup, the homepage and the contact page. A price per extra page. Feature add-ons like booking, a small shop or a second language. Copywriting, if you write the text. A monthly care plan, shown separately from the one-off price. The numbers below are placeholders. Use your own hours and rates, not someone else's price list.

The pricing logic Pure function, no DOM, easy to test: export Two choices worth copying: A range instead of one number. Scope always moves a little, and a range sets that expectation from the start. Unknown features throw. If the form and the price list drift apart, you find out immediately instead of quoting $0 for a feature. The form Plain HTML.

Every input has a name, so FormData can read it without any wiring: lang="en"> charset="utf-8"> name="viewport" content="width=device-width, initial-scale=1"> Website cost calculator id="calc"> Number of pages type="number" name="pages" min="1" max="40" value="5"> Features type="checkbox" name="features" value="booking"> Online booking type="checkbox" name="features" value="shop"> Small online shop type="checkbox" name="features" value="blog"> Blog type="checkbox" name="features" value="multilingual"> Second language type="checkbox" name="copywriting"> I need the text written type="checkbox" name="carePlan"> Add a monthly care plan id="result" for="calc" aria-live="polite"> type="module" src="app.js"> The element with aria-live="polite" means screen readers announce the new estimate when it changes.

Source disclosure

This is a source-linked briefing. Read the original report from Dev Community .