They say that the joys of being a grandparent can outnumber the joys of being a parent. After all, grandparents get little children to love and adore -- without the responsibilities and headaches that come with being in charge. Grandparents often have the flexibility to spoil their grandchildren with toys and goodies galore, as they're not the ones paying for more pressing needs like food, healthcare, and clothing.

But some grandparents may be taking their indulgence a little too far. According to a 2014 study by Fidelity Investments, more than 50% of grandparents are currently saving, or are planning to save, for their grandkids' college funds. Furthermore, an estimated 41% of grandparents are currently making regular contributions toward higher education for their grandchildren.

While there's nothing wrong with being generous, some grandparents may be sacrificing their retirement funds in the process. Those surveyed reported a median college contribution goal of $25,000, with 35% hoping to offer $50,000 or more. That's a lot of money to fork over, given the high cost of retirement today.

Put your own needs first
Helping your grandchildren pay for college is an admirable goal, but your first priority should be to make sure you're on track for a financially secure retirement. Before you put money into a college fund, take a long, hard look at your own account balance. Is it high enough to cover your estimated expenses in retirement, such as food and housing? Is there enough wiggle room to absorb late-stage market volatility that could send your account balance plunging downward when you need it the most?

Remember, the average couple retiring today at age 65 faces an estimated $245,000 in healthcare costs throughout retirement. This figure doesn't include expenses like nursing-home care. When you give your grandchildren money for college, make sure it's excess money -- not the money you're counting on to cover your basic retirement costs. After all, if worst comes to worst, your grandchildren can always take out a low-interest student loan. There's no such thing as a retirement loan.

Be strategic about contributing
Also realize that the more money you give your grandchildren for college, the less eligibility they'll have for financial aid. You might think that's a good problem to have, but unless you're planning to pay for your grandkids' education in full, they'll need other sources of money to cover tuition costs.

If you're going to help pay for college, be strategic about how you do it. Many grandparents like 529 plans because they allow contributions to grow tax-free. The downside is that 529 contributions from grandparents are counted as student income on the Free Application for Federal Student Aid (FAFSA), which means that while your grandkids might benefit from the money you've been saving, they could lose out on grants, subsidized federal loans, or other scholarship opportunities that could lower their tuition burden.

One way to get around this is to transfer ownership of a 529 account to your children -- your grandchildren's parents -- before withdrawals are made. This won't impact your grandkids' financial-aid eligibility nearly as much, as qualified distributions from parent-owned plans aren't counted as student income. Another option, if you're only planning to pay for a portion of your grandchildren's college costs, is to wait until each reaches his or her respective senior year of college before withdrawing funds. Unless your grandchildren are planning to attend graduate school, they won't need to apply for further financial aid at this point, so your contribution won't have any adverse effects on their eligibility.

No matter how big of a check you ultimately write toward your grandkids' tuition, be sure to share your savings strategy with them so that they not only remember to be eternally grateful, but employ similar tactics when they're out in the real world. If you're going to treat your grandchildren to the gift of a college education, you might as well impart a little life lesson in the process.

Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.