Buy these 12 stocks now, big bucks are yours

There's nothing for sure when it comes to investing. But buying stocks that are just about to go "ex-dividend" might be the closest thing to an exception.

There are 12 stocks in the Standard & Poor's 500 index that pay dividend yields that are 3% or higher (more than the market's average of about 2%), including Altria, Williams and Clorox, that are about to go ex-dividend between now through July, says market research firm Bespoke Investment Group. Investors who buy the stocks before the ex-dividend date are entitled to receive the already-declared dividend when it's paid in the subsequent weeks.

Read MoreBetting on boring brings stock outperformance

Tobacco company Altria is the company nearing an ex-dividend date that pays the biggest dividend yield. Investors that buy the stock before June 12 are entitled to a 4.6% dividend yield that's payable on July 10. An investor who puts $10,000 into the stock will be entitled to the quarterly dividend worth $460.

More from USA Today:
Reduced sentences urged for non-violent drug offenders
Friendly fire kills 5 U.S. troops in Afghanistan
Militants seize Iraqi city of Mosul

Investors who buy before the ex-dividend date can count on the next dividend payment, but there's still risk. Typically, all things held equal, the price of the stock falls on the ex-dividend date by the amount of the dividend. That means while investors can count on the dividend cash coming their way, the value of the stock falls by the amount of the dividend.

And lastly, while there's no reason to expect that these companies wouldn't pay the dividends they declared, nothing's for sure until it's in your hand.

Below are the S&P 500 companies paying dividend yields of 3% or higher with ex-dividend dates through July and expected to boost dividends by 3% or more over the next three years:

Read More These 3 states house the 'ugliest' S&P stocks

Dividend yield
Ex-Dividend date
Altria MO 4.60% 6/12/2014
Verizon VZ 4.28% 7/8/2014
Xcel Energy XEL 3.86% 6/17/2014
Williams WMB 3.55% 6/11/2014
DTE Energy DTE 3.46% 6/12/2014
Leggett & Platt LEG 3.46% 6/11/2014
Iron Mountain IRM 3.38% 6/23/2014
Clorox CLX 3.31% 7/21/2014
General Electric GE 3.21% 6/19/2014
Garmin GRMN 3.19% 6/13/2014
Sysco SYY 3.07% 7/1/2014
Western Union WU 3.06% 6/12/2014
Bespoke Investment Group

—By Matt Krantz, USA Today