Only earnings are subject to a withdrawal penalty

Federal law imposes a 10% penalty on earnings for non-qualified distributions beginning in 2002. The penalty is not assessed on principal. (Distributions are allocated between principal and earnings on a pro-rata basis.) An exception to the penalty can be claimed if you terminate the account because the beneficiary has died or is disabled, or if you withdraw funds not needed for college because the beneficiary has received a scholarship.

All earnings will be subject to income tax

What could be worse than the penalty is the fact that the earnings portion of a non-qualified distribution that comes back to you, the account owner, will be subject to tax as ordinary income at your tax rate. (Some 529 plans allow you to direct the withdrawal to the beneficiary, which would presumably keep it in a low tax bracket.) In addition, if you were able to deduct your original contributions on your state income tax return, you will generally have to report additional state "recapture" income.

Excess funds? How to minimize the penalty...

You can change the beneficiary to another qualifying family member at any time in order to keep the account going and avoid (or at least delay) taking non-qualified withdrawals when the original beneficiary doesn't need those funds.