0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

住宅ローン計算機 - 元利均等 vs 元金均等、繰上返済シミュレーション付き

0
Posted at

作ったもの

Loan Calculatorhttps://sen.ltd/portfolio/loan-calc/

スクリーンショット

  • 元利均等 / 元金均等 の 2 方式
  • 毎月返済額 + 総利息 + 総支払額
  • 完全な償還予定表
  • 繰上返済シミュレーション
  • 元本 vs 利息の積み上げ棒グラフ

vanilla JS、ゼロ依存、ビルド不要node --test で 39 ケース。

元利均等の公式

const r = apr / 12 / 100;
return principal * r / (1 - Math.pow(1 + r, -months));

標準的な年金現価公式。毎月の返済額は一定だが、序盤は利息が大半を占め、徐々に元本返済の割合が増える。

1000万円 / 1% / 35年: 月々 28,228 円、総利息 185 万円。

元金均等との差額

元金均等は 元本部分が毎月固定、利息は残高に比例するので返済額が徐々に減る。初月が最大。

同じ条件で総利息が 10% 以上少なくなる(初月の支払いは増える)。「序盤を頑張れるなら元金均等、序盤の負担を減らしたいなら元利均等」が基本。

繰上返済シミュレーション

while (balance > 0) {
  const interest = balance * r;
  const principal = Math.min(payment + extra - interest, balance);
  balance -= principal;
}

毎月 extra 円追加で返済。残高が減る → 次月の利息が減る → 元本返済割合が増える → 残高がさらに減る、の複利効果で期間も総利息も大きく削減できる。

月 1 万円の繰上返済で期間が数年短縮、利息が百万円単位で節約できる場合も。

利率 0% の特別扱い

if (r === 0) return principal / months;

利率 0 だと公式の分母が 1 - 1 = 0 になって NaN。明示的に分岐して安全な計算に切り替え。

シリーズ

100+ 公開ポートフォリオ シリーズの #98 です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?