Menu

I Built a Pay Increase Calculator in Vanilla JS - Here's the Math (and the Currency Trick)
📰

I Built a Pay Increase Calculator in Vanilla JS - Here's the Math (and the Currency Trick)

DEV Community: javascript·Muhammad Ameen Khan·about 21 hours ago
#AR1AxePp
#devtojavascript#devto#dev#raise#calculator
Reading 0:00
15s threshold

A raise sounds simple until you try to picture what it actually pays. "5%" feels abstract - but $250 more per month , or $1.44 more per hour , is real.

So I built a free pay increase calculator for CalcVersa that turns any raise into the numbers that matter. No framework, no backend — one HTML file with vanilla CSS and JS that runs entirely in the browser. Here's how it works under the hood.

The three ways a raise arrives

Employers phrase raises three different ways, so the calculator has three modes:

Percentage - "You got a 5% raise." → new pay = current pay × (1 + % ÷ 100)

Flat amount - "We're adding $3,000." → percentage worked out backwards

New salary - an offer letter with a new figure → the raise % is (new − old) ÷ old × 100

The trick is normalising everything to annual pay first , whatever the input frequency:

function factor ( freq , hours ) { if ( freq === 'monthly' ) return 12 ; if ( freq === 'biweekly' ) return 26 ; if ( freq === 'weekly' ) return 52 ; if ( freq === 'hourly' ) return hours…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.