Skip to content

Instantly share code, notes, and snippets.

@SarasArya
Created April 13, 2017 10:52
Show Gist options
  • Save SarasArya/e40c75da90ba3e45d774c05ca9028693 to your computer and use it in GitHub Desktop.
Save SarasArya/e40c75da90ba3e45d774c05ca9028693 to your computer and use it in GitHub Desktop.
Take home salary calculation when you need to tell someone what is your expected CTC. So enter the salary you want, it will tell you how much salary you will be taking home
const salary = 246250;
const taxExempt = 250000;
const limit1 = 250000;
const taxPercentage1 = 0.1 // This should be changed to 0.05 from 2017-2018 fiscal
const limit2 = 500000;
const taxPercentage2 = 0.2
const limit3 = 1000000;
const taxPercentage3 = 0.3;
let taxBracket = null;
//decide the tax bracket that you lie in
if (salary < limit1) {
taxBracket = 1
} else if (salary >= limit1 && salary < limit2) {
taxBracket = 2;
} else if (salary >= limit2 && salary < limit3) {
taxBracket = 3;
} else {
taxBracket = 4;
}
//calculate payable tax
let taxpayable = 0;
if (taxBracket === 1) {
taxpayable = salary;
} else if (taxBracket === 2) {
let tax1 = (salary - limit1) * taxPercentage1
taxpayable = salary - tax1;
} else if (taxBracket === 3) {
let tax1 = limit1 * taxPercentage1;
let tax2 = (salary - 2 * limit1) * taxPercentage2
taxpayable = salary - tax1 - tax2;
} else if (taxBracket === 4) {
let tax1 = limit1 * taxPercentage1;
let tax2 = 2 * limit1 * taxPercentage2;
let tax3 = (salary - 4 * limit1) * taxPercentage3
taxpayable = salary - tax1 - tax2 - tax3;
}
console.log(`Take home salary is ${(taxpayable / 12).toFixed(1)} without the cess`);
//Todo add cesses and add support for surcharge on tax applied for people earning more than 60 lacs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment