Home › Trading Widgets › P/E Ratio Calculator Widget

P/E Ratio Calculator Widget

Work out a share's price-to-earnings ratio from the price and earnings per share, and see how it compares to the sector and the market. Copy one line of HTML and it runs inside your page, free, with no sign-up and no tracking of your readers.

⚡
One lineNothing to install
🛡️
No trackingOf you or your readers
🆓
FreeCommercial use allowed

Try the P/E Ratio Calculator Widget

Live previewThis is exactly what your readers will see

Free for any site, including commercial ones. Keep the small credit line at the bottom of the widget so readers can find the full version. Nothing is stored about the people who use it. See the disclaimer.

How to add it to your site

  1. Copy the code Use the copy button in the Embed code box so nothing is lost to line wrapping. It is a single iframe tag and it does not need anything else.
  2. Open the page you want it on In WordPress add a Custom HTML block, in Wix use the Embed HTML element, in Squarespace use a Code block, and on a hand-built site paste it straight into your HTML.
  3. Paste and publish The widget appears immediately. If you see an empty space instead, your editor has stripped the iframe tag, which the HTML embed guide explains how to work around.
  4. Adjust the look if you want to Add the parameters in the table below to the iframe URL to change the theme, the accent colour or the height. Nothing needs to be configured on our side.

Customisation options

ParameterValuesWhat it does
themeauto, light, darkDefault follows the reader's own system setting, so the widget looks right on a dark site and a light one without you choosing.
accentSix hex digits, e.g. accent=1A56DBRecolours the header bar and the primary button to match your brand.
header1 or 0Set to 0 to hide the title bar when your page already has a heading above the widget.
breakdown1 or 0Set to 0 to hide the calculation breakdown for a more compact block.
corners1 or 0Set to 0 for square corners if your design has no rounding anywhere else.
widthfullRemoves the 520px maximum so the widget stretches to its container.

Parameters are added to the iframe URL as a normal query string, for example /embed/pe-ratio-calculator.html?theme=dark&accent=1A56DB&header=0. The widget builder lets you set all of them visually and hands you the finished code.

Why embed the P/E Ratio Calculator

The P/E ratio is the first number quoted about any share and the least understood. The widget takes price and earnings per share and returns the multiple, with the earnings yield and the years of earnings the price represents. Share analysis pages and investing basics both have a use for it.

What the widget calculates

The price-to-earnings ratio is the most quoted number in equity investing: what you pay for each rand of annual profit. A P/E of 12 means the price is twelve times the company's yearly earnings per share.

It is a comparison tool rather than a verdict. A low P/E can mean a bargain or a business in decline, and the only way to tell is to compare against the sector, the company's own history, and why the market has priced it where it has.

The embedded version keeps the inputs and the result. The full P/E Ratio Calculator on TradeAnswers adds worked examples, the method behind the numbers and a long FAQ.

Who this widget suits

Investing and share research blogs

Readers can value a share on the page instead of opening a spreadsheet.

Finance courses and study sites

A live calculation under the formula makes the method concrete.

Investor clubs and newsletters

A shared tool gives members a common way to compare companies.

Related widgets

The full library of free trading widgets has more than a hundred tools, and the widget builder lets you preview and configure any of them before you copy the code.