Take the stated rate, add any fees to get annual costs, divide by principal, compound for the period, subtract 1. For example, 5% APR compounded monthly has a ~5.1% EAR due to compounding.