While it's tempting for consumers to spend their tax refund on dining out at new trendy restaurants or buying the latest electronics, investing their tax dollars in an IRA or stocks now can generate a substantial amount of savings.

Whether the savings is utilized for emergencies such as car repairs or to fund a retirement portfolio, even a fairly mediocre rate of return on your savings such as 6% yields nearly four dollars for each dollar stashed away in a couple of decades.

"Although it's a lot more fun to spend your tax refund on a vacation or shopping spree, saving it for retirement is often a smarter choice," said David Twibell, president of Custom Portfolio Group, an Englewood, Colo. "Even if you only set aside a portion of it in savings each year, it can make a huge difference down the road."

As many Gen X-ers and Millennials are woefully behind on their retirement savings, contributing to a Roth IRA can generate higher returns since money allocated into them grow tax-free forever.

"That means you never have to pay tax on a dime of the money in your Roth IRA, regardless of how much it grows," he said. "Combining the power of compounding growth with a tax-free investment vehicle can go a long way to helping you enjoy a happy and financially-stable retirement."

The rule of 72 helps investors determine the amount of the return their refund will generate. Investing $3,000, which is the average amount taxpayers receive, and generating 8% per year, which is akin to the average stock market yearly return, means it will only take nine years to double the money, said Yale Bock, a portfolio manager with Covestor, the online investing company, and president of Y H & C Investments in Las Vegas.

"Over 20 years, you would wind up with over $12,000 and nearly $20,000 over 30 years and this isn't including if you reinvest the dividends," he said.

Aside from investing in broad stock market indexes such as the S&P 500, Dow or Nasdaq, purchasing stocks such as 3M (MMM) , Johnson & Johnson (JNJ) , Exxon (XOM) , Chevron (CVX) , McDonald's (MCD) or Berkshire Hathaway (BRK.B) are beneficial, because they are "large companies you can rely on to stand the test of time," Bock said.

Buying a low-cost fund like Vanguard Total Stock Market Index Investor Shares (VTSMX) is a good start for smaller tax refunds or good dividend stocks such as AT&T (T) , Verizon (VZ) or Exxon can also be suitable, said Ron McCoy, founder of Freedom Capital Advisors in Winter Garden, Fla.

"The biggest thing is simply putting the money away and not going out and spending it immediately," he said.

Allocating the refund into a Roth IRA is a good strategy because investors are not taxed when they withdraw their funds in retirement. It can also be used by consumers before they reach the age of 59.5 for a down payment for a first home or education or for medical emergencies or a hardship without paying penalties.

An investment of $3,000 today could produce $50,000 over 30 years because of the power of compound investing, said Daniel Johnedis, president of Cratus Capital in Savannah, Ga. and a portfolio manager on Covestor, the online investing company.

"If you are expecting to receive a tax refund, always apply for this  as early as possible," he said. "If you invest $3,000 using a 10% average annual return, you will have $7,781 after 10 years and this amount will grow to $20,183 after 20 years and will be worth $52,348 after 30 years."

Even if taxpayers only invested half of their tax refund each year and set up a brokerage account or an IRA account, they would have "significantly more money as the impact of compound investing as well as annual contributions will multiply the assets in your account in a few short years," Johnedis said. "Stick to this habit and you will have a nice nest egg in retirement."

Diversifying your retirement portfolio is key and some solid stock ideas would be Amazon (AMZN) , Alphabet (GOOGL) , Facebook (FB) or Netflix (NFLX) , he said. Adding stocks that are less widely followed, but have "great upside" like Panhandle Oil and Gas (PHX) , US Auto Parts Network (PRTS) and PGT Innovations (PGTI) can also be advantageous.

"Two high income preferred stocks are BB&T Bank (BBT) and Pacific Gas and Electric (PCG) and a couple of good mutual funds which will provide great diversification are the Permanent Portfolio (PRPFX) and the Oakmark Global Fund (OAKWX) ," Johnedis said. "In addition, add a couple of low cost ETFs to get broad market exposure including the Vanguard Total Stock ETF (VTI) , and SPDR S&P 500 ETF Trust (SPY) ."

New investors should buy three stocks - a growth stock, an income stock and one that combines a little of both and hold onto them for at least a year so they emerge as investments and not just trades, said Barry Randall, a technology portfolio manager on Covestor, the online investing company with offices in Boston and London.

He recommends starting with stored-value payment card vendor Green Dot Corp. (GDOT) for growth, health care-oriented real estate investment trust HCP Inc. (HCP) for income and defense contractor General Dynamics (GD) for a little of both. (Randall owns shares of Green Dot, HCP and General Dynamics both personally and in client accounts.)

"This way you'll build your investing 'muscles' and be strong enough to resist buying and selling just for the stimulation of it," he said. "Brokers often offer a set amount of free trades to new investors to sweeten the appeal of becoming an investor. The problem with that is that if you're trading a lot, you're not investing. You're just trading and the overwhelming majority of day traders lose money overall."

More from Taxes

What Is Amortization and How Do You Use It To Pay Off Loans?

What Is Amortization and How Do You Use It To Pay Off Loans?

Five Reasons to Borrow From Your 401(k) and How to Do It

Five Reasons to Borrow From Your 401(k) and How to Do It

11 Best States to Retire on a Fixed Income

11 Best States to Retire on a Fixed Income

What Is a W-4 Form and How Do Allowances Work?

What Is a W-4 Form and How Do Allowances Work?

How to Reduce Your 2018 Tax Bill - Yes, There's Still Time

How to Reduce Your 2018 Tax Bill - Yes, There's Still Time