How I built a set of free salary calculators with React, Vite and TypeScript
I recently built SalaryPayTools , a small site of free US pay calculators. Here is a short write-up of how it is put together and
What it does
</h2> <p>There are 14 calculators: hourly to salary and salary to hourly, annual income, weekly, biweekly and monthly pay, part-time pay, overtime, pay raise, a basic 2026 federal income tax estimate, and 2026 take-home pay for four states (Texas, Arkansas, Illinois and North Carolina). They are free and need no signup.</p> <h2>The stack
</h2> <p>React + Vite + TypeScript. Vite keeps the dev loop fast, and TypeScript helps because many pay-calculator bugs are unit mix-ups: hourly vs. annual, weekly vs. biweekly, a percentage stored as 5 instead of 0.05.</p> <h2>Keep the math in plain functions
</h2> <p>The calculators are mostly forms on top of small, pure functions. A simplified sketch of the idea (not the site's exact code):<br> </p> <div class="highlight js-code-highlight"> <pre class="highlight typescript"><code><span class="kd">type</span> <span class="nx">HourlyInput</span> <span class="o">=</span> <span class="p">{</span> <span class="na">rate</span><span class="p">:</span> <span class="kr">number</span><span class="p">;</span> <span class="nl">hoursPerWeek</span><span class="p">:</span> <span class="kr">number</span><span class="p">;</span> <span class="nl">weeksPerYear</span><span class="p">:</span> <span class="kr">number</span><span class="p">;</span> <span class="nl">overtimeHours</span><span class="p">:</span> <span class="kr">number</span><span class="p">;</span> <span class="nl">overtimeMultiplier</span><span class="p">:</span> <span class="kr">number</span><span class="p">;</span> <span class="c1">// 1.5 for time-and-a-half</span> <span class="p">};</span><span class="k">export</span> <span class="kd">function</span> <span class="nf">annualGross</span><span class="p">(</span><span class="nx">i</span><span class="p">:</span> <span class="nx">HourlyInput</span><span class="p">):</span> <span class="kr">number</span> <span class="p">{</span> <span class="kd">const</span> <span class="nx">weekly</span> <span class="o">=</span> <span class="nx">i</span><span class="p">.</span><span class="nx">rate</span> <span class="o"></span> <span class="nx">i</span><span class="p">.</span><span class="nx">hoursPerWeek</span> <span class="o">+</span> <span class="nx">i</span><span class="p">.</span><span class="nx">rate</span> <span class="o"></span> <span class="nx">i</span><span class="p">.</span><span class="nx">overtimeHours</span> <span class="o"></span> <span class="nx">i</span><span class="p">.</span><span class="nx">overtimeMultiplier</span><span class="p">;</span> <span class="k">return</span> <span class="nx">weekly</span> <span class="o"></span> <span class="nx">i</span><span class="p">.</span><span class="nx">weeksPerYear</span><span class="p">;</span> <span class="p">}</span> </code></pre>
</div> <p>Functions like this are easy to test with known answers before any UI exists. For example, $20 an hour × 40 hours × 52 weeks should always give $41,600.</p> <h2>Show the formula next to the answer
</h2> <p>Every result on the site shows how it was calculated, e.g. <code>($20.00 × 40) × 52 paid weeks</code>. A number you can't check is hard to trust, so the formula is always right there.</p> <h2>One page per calculator
</h2> <p>Each calculator has its own URL and its own HTML page with the content already in it, so the page isn't empty before JavaScript loads. That helps both search engines and slow phones.</p> <h2>Be clear about scope
</h2> <p>The federal tax tool is a basic estimate, and take-home pay is only for the four states above. I'd rather say that plainly than pretend to cover everything.</p> <p>If you want to try it or check my math: <a href="https://salarypaytools.com/" rel="noopener noreferrer">salarypaytools.com</a>. Feedback is welcome.</p>Original source
Tags
Related Articles
Continue reading with these similar posts

Apple’s M5 MacBook Air is down to its lowest price since July
Read Apple’s M5 MacBook Air is down to its lowest price since July and explore its linked sources.

🏈 Connelly: How CFB Week 10's top games were won
From Notre Dame's CJ Carr to Alabama's consistency, we examine the keys to victory on a statement Saturday.

Harbaugh: Giants pulled recent offer for RB Taylor but 'things do change'
The Giants pulled a recent trade offer for Jonathan Taylor, according to coach John Harbaugh, who added that doesn't mean a deal is completely off the table.

Reaves steps into Luka's shoes, drops 43 in win vs. Pistons
Austin Reaves did his best Luka Doncic impression with the MVP candidate resting vs. the Pistons on Sunday, scoring 43 points in the 121-116 win.

Giants' Nabers takes issue with Fox telecast after body-language comments
Malik Nabers took issue with Fox play-by-play man Joe Davis and analyst Greg Olsen for criticizing his body language during the Giants' win Sunday.

Bears' Williams undeterred by career-high 4 INTs: 'Going to keep grippin' it, keep rippin' it'
Caleb Williams refused to let his four interceptions rattle his confidence as he put the Bears in position to beat the Buccaneers on a walk-off field goal.