This is the prettiest mortgage calculator I have seen online. You can really see how your principal and interest go during your loan term. Recommended!
http://www.interest.com/mortgage/calculators/mortgage-calculator/
Here is the math: http://mortgage.lovetoknow.com/Amortization_Chart_Additional_Payments