The price-to-earnings ratio compares the stock price to the actual earnings of the company. The P/E ratio is calculated by dividing the stock price by the earnings per share (EPS).