Independent investing education · No ads · No affiliate links · Not financial advice

CalculatorsBeginner

P/E ratio calculator

Two numbers in, two numbers out: the price-to-earnings ratio and the earnings yield. Here is what each one measures and where the ratio stops being useful.

JavaScript is off, so the result on the right shows the example inputs above. The method and a worked example are explained below.

Result

Price-to-earnings ratio

20.0

Earnings yield
5.00%

An illustration with a fixed rate, not a forecast. Taxes, fees (unless entered) and real-world ups and downs are not included.

Quick answer

This calculator divides a share price by earnings per share over the last 12 months to give the P/E ratio, and shows the reverse — EPS as a percentage of price, the earnings yield. When earnings are zero or negative, P/E is shown as not meaningful [1].

Key points

  • P/E = share price ÷ earnings per share (EPS) for the last 12 months.
  • Earnings yield = EPS ÷ share price, shown as a percentage. It is the P/E turned upside down.
  • A P/E of 20 means investors are paying $20 for each $1 of yearly earnings.
  • If EPS is zero or negative, the P/E is not meaningful and the tool says so.
  • P/E ratios differ a lot between industries, so compare like with like.

#What does the P/E ratio tell you?

Investor.gov describes the price-earnings ratio as "a way of gauging whether the stock price is high or low compared to the past or to other companies" [1]. It links two numbers: what the market charges for one share, and how much profit the company earned for each share.

The calculator has two inputs: Share price and Earnings per share, last 12 months. Earnings per share (EPS) is "A public company's net profit divided by the number of its common shares" [2]. You can find EPS in a company's quarterly and annual reports — see how to read financial statements. The tool returns the P/E ratio and the earnings yield.

#How does the calculation work?

  • P/E ratio = share price ÷ EPS (last 12 months).
  • Earnings yield (%) = EPS ÷ share price × 100.
  • If EPS is zero or negative, the P/E is shown as not meaningful. A company with no profit has no positive multiple to report.

Investor.gov gives the same method: divide the current price by earnings per share, where EPS uses the earnings for the past 12 months [1]. This is often called a trailing P/E because it looks back at reported earnings, not at analyst estimates.

Worked example

Worked example: a $120 share

Share price $120 · Earnings per share over the last 12 months $6. Calculated in Python with the formulas above.

P/E ratio ($120 ÷ $6)
20.0
Earnings yield ($6 ÷ $120 × 100)
5.00%
Same price, EPS $4.80: P/E
25.0
Price $30, EPS −$1.50: P/E
not meaningful

At $120 with $6 of yearly earnings per share, the stock trades at 20 times earnings — an earnings yield of 5%.

Hypothetical companies. A ratio describes today's price relative to past earnings; it is not a forecast.

Same $6 EPS at three share prices
Share priceP/E ratioEarnings yield
$9015.06.67%
$12020.05.00%
$15025.04.00%

#How should you compare P/E ratios?

FINRA advises checking how a ratio compares with the market as a whole and with the company's industry, "since there can be significant variation in the average ratio across industries" [3]. A fast-growing software firm and a utility can have very different typical P/Es for reasons that have nothing to do with being cheap or expensive. Comparing a company's P/E with its own past can also help.

Two ways to read the same numbers

P/E ratio

  • Price ÷ EPS
  • Dollars paid per $1 of earnings
  • Higher = market pays more for each $1 of profit

Earnings yield

  • EPS ÷ price
  • Earnings per $100 invested, as %
  • Easier to set beside a bond yield or interest rate

#What this calculator leaves out

  • Why the ratio is high or low. Expected growth, debt, risk and one-off gains or losses all affect P/E. The tool cannot tell which one is at work.
  • One-off items in EPS. A single asset sale or write-down can swing 12-month earnings and make the P/E misleading.
  • Forward estimates. The tool uses past earnings only; forward P/Es based on forecasts are a different measure.
  • Losses. For companies with zero or negative earnings, P/E gives no usable number at all.

What's the bottom line?

The P/E ratio is one division: price over the last 12 months of earnings per share. This calculator does that division, flips it into an earnings yield, and refuses to give a number when earnings are not positive. The harder part is interpretation — compare within an industry and read the article on the price-to-earnings ratio before drawing conclusions.

Frequently asked questions

What is a good P/E ratio?

There is no single good number. Typical ratios vary widely by industry and over time, so a P/E only means something next to comparable companies or the company's own history.

Why does the calculator say not meaningful?

Because EPS is zero or negative. Dividing a price by a loss gives a negative or undefined number that does not describe value in any useful way.

Where do I find earnings per share?

In a public company's annual and quarterly reports. Add up the last four quarters of EPS to get a trailing 12-month figure.

What is earnings yield used for?

It expresses earnings as a percentage of the price, so it can sit next to other percentages such as bond yields. It is simply 1 divided by the P/E, times 100.

Sources

Grade A = primary source (regulator, government agency, official rulebook or the index provider's own documents). Numbers in brackets in the text point here.

  1. U.S. SEC — Investor.gov. Price-earnings (P/E) Ratio (glossary) (2026). Accessed 2026-10-03.A
  2. U.S. SEC — Investor.gov. Earnings Per Share (glossary) (2026). Accessed 2026-10-03.A
  3. FINRA. Evaluating Stocks (2026). Accessed 2026-10-03.A

This page is general education, not personal financial, tax or legal advice. Figures in worked examples are hypothetical and calculated before taxes and fees unless stated. Rules and limits change; check the linked primary sources for the current version. How we check every page.