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

Sources: Missouri RB Hardy, shot in offseason, to return vs. Arkansas
Missouri All-America tailback Ahmad Hardy is set to make his season debut for the Tigers this weekend at Arkansas, sources told ESPN.

Red Wings suspend Larkin as team explores trade options; players keen to move on
The Red Wings announced Thursday that star forward Dylan Larkin has been suspended without pay after informing the team he no longer wanted to play for Detroit.

Packers' Jacobs says TD celebration was ode to gospel song, not mocking arrest
The Packers' Josh Jacobs said he was surprised his first-half TD celebration was perceived by some as mocking his May arrest, saying it was an ode to a gospel song.

Israel faces weeks of coalition haggling as Netanyahu’s party claims election 'stolen'
Israel's election leaves the country facing weeks of coalition bargaining and an uphill battle for the opposition party to form a majority government.
Herdr has released native app
Comments

Satellite vs Fiber Internet: ഇന്ത്യയുടെ ഇന്റർനെറ്റ് വിപ്ലവത്തിന് ആര് മികച്ചത്?
ഇന്ന് ഇന്റർനെറ്റ് ഒഴിച്ചുകൂടാനാവാത്ത ഭാഗമായി മാറിക്കഴിഞ്ഞു. ഇപ്പോൾ ഇന്ത്യയിൽ നിലവിൽ ഏറ്റവും ജനപ്രിയമായ ഇന്റർനെറ്റ് മാധ്യമം ഒപ്റ്റിക്കൽ ഫൈബർ (Fiber Internet) ആണ്. എന്നാൽ രാജ്യത്ത് സജീവ ചർച്ചയായി മാറിക്