One way to analyze the opportunity cost of using a 401K loan would be to calculate your net worth after using a 401K loan. If your net worth increases then the 401K loan would be advisable. Note that the calculations provided below do not take into account tax considerations.
A net worth calculation is where you add all your assets and then subtract all your liabilities. The resulting number is your net worth.
First, calculate the net worth of not taking the loan and simply paying the credit card interest. This means you only pay the interest on the credit card. In addition to the parameters identified in your question, two additional parameters will need to be considered: Cash and the market rate of return on the 401K.
Scenario 1 (only pay credit card interest):
After 12 months all you have paid is the interest on the credit card. The 401K balance is untouched so it will hopefully grow. The balance on the credit card remains at the end of 12 months.
|---Change in cash----| |---Change in 401K---|
Assets = C – ($5,000 * CCIR) + $5,000 * (1 + MRR)
|--Credit card balance--|
Liabilities = $5,000
Net worth = C – 5,000*CCIR + 5,000 + 5000*MRR – 5000
= C – 5,000*CCIR + 5,000*MRR
Where
C = Cash
CCIR = Credit Card Interest Rate
MRR = Market Rate of Return you can earn on your 401K.
Scenario 2 (use 401K loan to pay credit card balance):
You borrow $5,000 from your 401K to pay the credit card balance. You will have to pay $5,000 plus the 401K interest rate back into your 401K account.
|---Change in cash----| |---Change in 401K---|
Assets = C – $5,000 * (1 + KIR) + $5,000 * (1 + KIR)
|--Credit card balance--|
Liabilities = $0
Net worth = C – 5,000 – 5,000*KIR + 5,000 + 5,000*KIR
= C
Where
KIR = 401K Interest Rate
Use the following equation to determine when Scenario 2 increases your net worth more than scenario 1:
C > C – 5,000*CCIR + 5,000*MRR
Which simplifies to:
CCIR > MRR
Thus, if your credit card interest rate is greater than the rate you can earn on your 401K then use the 401K loan to pay off the credit card balance.
Another scenario that should be considered: borrow money from somewhere else to pay off the credit card balance.
Scenario 3 (external loan to pay credit card balance):
You borrow $5,000 from somewhere besides your 401K to pay off the credit card balance.
|---Change in cash----| |---Change in 401K---|
Assets = C – $5,000 * (1 + EIR) + $5,000 * (1 + MRR)
|--Credit card balance--|
Liabilities = $0
Net worth = C – 5,000 – 5,000*EIR + 5,000 + 5,000*MRR
= C - 5,000*EIR + 5,000*MRR
Where
EIR = External Interest Rate
The following is used to determine if you should use an external loan over the 401K loan:
C - 5,000*EIR + 5,000*MRR > C
Which simplifies to:
MRR > EIR
This means you should use an external loan if you can obtain an interest rate less than the rate of return you can earn on your 401K. The same methodology can be used to compare Scenario 3 to Scenario 1.