국민계산기 API

35개 금융 계산 함수를 JavaScript SDK, iframe, URL 파라미터로 자유롭게 활용하세요

목차

개요

국민계산기 API는 연봉 실수령액, 대출이자, 세금, 부동산, 보험, 생활 등 35개 금융 계산 함수를 외부 서비스에서 손쉽게 활용할 수 있도록 제공합니다.

모든 계산은 CalcCore 객체에 구현되어 있으며, 별도의 API 키나 인증 없이 무료로 사용할 수 있습니다.

주요 특징

사용 방법

1. JavaScript SDK

calculator-core.js 파일을 로드하면 CalcCore 전역 객체를 통해 모든 계산 함수를 직접 호출할 수 있습니다.

<!-- 1. 스크립트 로드 --> <script src="https://kukmincalc.com/assets/js/calculator-core.js"></script> <!-- 2. 함수 호출 --> <script> // 연봉 실수령액 계산 const result = CalcCore.takeHomePay(50000000); console.log(result.takeHome); // 월 실수령액 console.log(result.totalDeduction); // 월 공제액 // 대출이자 계산 (원리금균등) const loan = CalcCore.loanEqualPayment(100000000, 3.5, 360); console.log(loan.monthly); // 월 상환액 </script>

2. iframe 임베드

특정 계산기 페이지를 <iframe>으로 삽입하여 사이트 내에 계산기를 그대로 임베드할 수 있습니다.

<!-- 연봉 실수령액 계산기 임베드 --> <iframe src="https://kukmincalc.com/calculators/take-home-pay.html" width="100%" height="800" frameborder="0" style="border: 1px solid #e2e8f0; border-radius: 12px;" ></iframe>

URL 파라미터 API를 iframe으로 사용하면 postMessage를 통해 계산 결과를 받을 수 있습니다.

<!-- API iframe + postMessage 결과 수신 --> <iframe id="calcFrame" src="https://kukmincalc.com/api/calculate.html?fn=takeHomePay&annualSalary=50000000" style="display:none" ></iframe> <script> window.addEventListener('message', function(e) { if (e.data && e.data.type === 'gukmin-calc-result') { console.log(e.data.data); // 계산 결과 } }); </script>

3. URL 파라미터 API

URL 쿼리 파라미터로 함수명과 인자를 전달하면 JSON 결과를 화면에 표시합니다.

엔드포인트

https://kukmincalc.com/api/calculate.html?fn=함수명&param1=값1&param2=값2

요청 예시

// 연봉 실수령액 /api/calculate.html?fn=takeHomePay&annualSalary=50000000 // 대출이자 (원리금균등) /api/calculate.html?fn=loanEqualPayment&principal=100000000&rate=3.5&months=360 // BMI 계산 /api/calculate.html?fn=bmi&height=175&weight=70

응답 형식

{ "success": true, "function": "takeHomePay", "params": { "annualSalary": "50000000" }, "data": { "monthly": 4166667, "takeHome": 3476498, "totalDeduction": 690169, ... }, "timestamp": "2026-02-16T...", "credit": "국민계산기 (https://kukmincalc.com)" }

참고: 함수명 없이 엔드포인트에 접속하면 사용 가능한 함수 목록을 반환합니다. 직접 확인

함수 레퍼런스 (35개)

모든 함수는 CalcCore.함수명(인자)로 호출하며, 객체(Object)를 반환합니다.

근로 근로/급여 (10개)

함수명파라미터반환값테스트
takeHomePay annualSalary, dependents=1, childUnder20=0, nonTaxable=200000 monthly, takeHome, totalDeduction, nationalPension, healthInsurance, longTermCare, employmentIns, incomeTax, localTax, annualTakeHome Try
hourlyWage monthlySalary, weeklyHours=40 hourly, monthlyHours Try
hourlyToMonthly hourlyWage, weeklyHours=40 monthly, monthlyHours Try
overtimePay hourlyWage, overtimeHours, isNight=false, isHoliday=false Number (수당 금액) Try
annualLeavePay dailyWage, unusedDays Number (연차수당 금액) Try
annualLeaveCount totalYears, totalMonths Number (연차 일수) Try
severancePay avgDailySalary, totalDays Number (퇴직금 금액) Try
severancePayFromMonthly monthlySalary, years, months=0 Number (퇴직금 금액) Try
unemployment avgDailySalary, age, workYears daily, days, total, monthly Try
pension monthlySalary base, employee, employer, total Try

세금 세금 (6개)

함수명파라미터반환값테스트
incomeTax totalIncome, deductions=0 tax, localTax, total, effectiveRate Try
vat supplyValue, type='include' supply, vat, total Try
capitalGainsTax salePrice, buyPrice, expenses=0, holdingYears=1, isOneHouse=false gain, taxableGain, tax, localTax, total, longTermDeduction Try
giftTax giftAmount, relation='child', previousGifts=0 exemption, taxable, tax, effectiveRate Try
inheritanceTax totalAssets, debts=0, funeralCost=0, spouse=true, children=1 netAssets, totalDeduction, taxable, tax Try
acquisitionTax price, area=85, isFirstHome=true, numHouses=0 rate, acqTax, eduTax, specialTax, total Try

부동산 부동산 (8개)

함수명파라미터반환값테스트
propertyTax publicPrice taxBase, propertyTax, cityTax, eduTax, total Try
comprehensivePropertyTax totalPublicPrice, numHouses=1 taxBase, tax, farmTax, total Try
mortgageLimit housePrice, annualIncome, existingDebt=0, ltv=0.7, dti=0.4, dsr=0.4 ltvLimit, dtiLimit, dsrLimit, limit Try
dsr annualIncome, loans (배열 — SDK에서만 사용 가능) totalAnnualPayment, dsr
rentToDeposit monthlyRent, conversionRate=4.5 deposit Try
depositToRent deposit, conversionRate=4.5 monthlyRent Try
movingCost houseType='1room', distance=10, floor=1, hasElevator=true, season='normal' cost Try
remodelCost area, level='standard' cost, pyeong Try

금융 대출/금융 (7개)

함수명파라미터반환값테스트
loanEqualPayment principal, rate, months, grace=0 monthly, total, interest, graceMonthly Try
loanEqualPrincipal principal, rate, months, grace=0 firstMonthly, lastMonthly, totalInterest, total Try
loanBullet principal, rate, months monthly, total, interest, finalPayment Try
prepaymentFee amount, rate=1.5, remainingMonths=0, totalMonths=36, type='fixed' Number (수수료 금액) Try
depositInterest principal, annualRate, months, type='deposit', taxRate=0.154 interest, tax, afterTax, total (적금: +totalDeposit) Try
compoundInterest principal, annualRate, years, compoundPerYear=12, monthlyAdd=0 amount, totalInvested, interest Try
exchangeRate amount, rate, direction='to_krw' result Try

보험 보험 (3개)

함수명파라미터반환값테스트
healthInsurance monthlySalary health, longTerm, employeeHealth, employeeLong, employeeTotal Try
employmentInsurance monthlySalary, companySize='small' employee, employer, total Try
industrialInsurance monthlySalary, industryRate=0.007 premium, rate Try

생활 생활 (7개)

함수명파라미터반환값테스트
carCost carPrice, fuelType='gasoline', kmPerMonth=1000, fuelEfficiency=12, fuelPrice=1650 fuelCost, insurance, maintenance, tax, depreciation, total, totalWithDepr Try
weddingCost hallType='hotel', guests=200, giftPerPerson=50000 hallCost, mealCost, photoCost, dressCost, honeymoon, total, expectedGift, netCost Try
childCost age=0, region='seoul' daycare/education, food, medical, misc, total, annual Try
bmi height, weight bmi, category, normalMin, normalMax Try
unitConvert value, from, to result Try
tipCalculator totalAmount, tipPercent=0, numPeople=1 tip, totalWithTip, perPerson Try
dateCalculator startDate, endDate days, weeks, months, years Try

* 이탤릭 파라미터는 선택 사항(기본값 존재). URL 파라미터 API에서 배열 인자(loans)를 받는 dsr 함수는 SDK 방식에서만 사용 가능합니다.

사용 예시

연봉 실수령액 + 결과 표시

<script src="https://kukmincalc.com/assets/js/calculator-core.js"></script> <script> const salary = 60000000; // 연봉 6천만원 const r = CalcCore.takeHomePay(salary, 2, 1); document.getElementById('result').innerHTML = ` 월급: ${(r.monthly).toLocaleString()}원 실수령액: ${r.takeHome.toLocaleString()}원 공제합계: ${r.totalDeduction.toLocaleString()}원 ── 4대보험 ── 국민연금: ${r.nationalPension.toLocaleString()}원 건강보험: ${r.healthInsurance.toLocaleString()}원 장기요양: ${r.longTermCare.toLocaleString()}원 고용보험: ${r.employmentIns.toLocaleString()}원 ── 세금 ── 소득세: ${r.incomeTax.toLocaleString()}원 지방세: ${r.localTax.toLocaleString()}원 `; </script> <pre id="result"></pre>

대출 상환 방식 비교

const P = 300000000, R = 4.0, M = 360; const ep = CalcCore.loanEqualPayment(P, R, M); const ec = CalcCore.loanEqualPrincipal(P, R, M); const bl = CalcCore.loanBullet(P, R, M); console.table({ '원리금균등': { 월상환: ep.monthly, 총이자: ep.interest }, '원금균등': { 월상환: ec.firstMonthly, 총이자: ec.totalInterest }, '만기일시': { 월상환: bl.monthly, 총이자: bl.interest }, });

iframe postMessage 연동

// 부모 페이지에서 결과 수신 window.addEventListener('message', (e) => { if (e.data?.type === 'gukmin-calc-result' && e.data.success) { console.log(`함수: ${e.data.function}`); console.log('결과:', e.data.data); } }); // 동적으로 계산 요청 function calculate(fn, params) { const qs = new URLSearchParams({ fn, ...params }); const frame = document.getElementById('calcFrame'); frame.src = `https://kukmincalc.com/api/calculate.html?${qs}`; } calculate('bmi', { height: 175, weight: 68 });
광고 영역