CAPE or cyclically adjusted price-to-earnings ratio is one way to assess whether a stock market is overvalued. CAPE was originally developed by Benjamin Graham, and has been used by various analysts since then such as Professor Robert Shiller of Yale University.
CAPE takes the current value of the stocks of the S&P 500 (or any stock market you were interested in) and divides that value by the average annual inflation-adjusted earnings of the companies in the S&P 500 index over the past 10 years. 10 years is not a magical value; investors such as Benjamin Graham posited that longer time-frames irons-out bumps in profits caused by the usual short-term economic noise. (Note, here again we see the importance of filtering signal from noise, something managers who fret over weekly, monthly or quarterly results miss when they do not look at longer-term data sets for their business.)
Perspective is, as always, an important element of insight. Below is the CAPE ratio over the past 130 years (graphic by The Economist). Notice anything?