.pe-calc-container {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
max-width: 800px;
margin: 20px auto;
padding: 25px;
border: 1px solid #e1e4e8;
border-radius: 12px;
background-color: #ffffff;
box-shadow: 0 4px 6px rgba(0,0,0,0.05);
color: #333;
}
.pe-calc-header {
text-align: center;
margin-bottom: 30px;
}
.pe-calc-header h2 {
color: #1a73e8;
margin-bottom: 10px;
}
.pe-calc-form {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
margin-bottom: 25px;
}
@media (max-width: 600px) {
.pe-calc-form { grid-template-columns: 1fr; }
}
.pe-input-group {
display: flex;
flex-direction: column;
}
.pe-input-group label {
font-weight: 600;
margin-bottom: 8px;
font-size: 14px;
}
.pe-input-group input {
padding: 12px;
border: 2px solid #ddd;
border-radius: 6px;
font-size: 16px;
transition: border-color 0.3s;
}
.pe-input-group input:focus {
border-color: #1a73e8;
outline: none;
}
.pe-calc-btn {
grid-column: 1 / -1;
background-color: #1a73e8;
color: white;
padding: 15px;
border: none;
border-radius: 6px;
font-size: 18px;
font-weight: bold;
cursor: pointer;
transition: background-color 0.3s;
}
.pe-calc-btn:hover {
background-color: #1557b0;
}
.pe-result-box {
margin-top: 30px;
padding: 20px;
background-color: #f8f9fa;
border-radius: 8px;
text-align: center;
display: none;
}
.pe-result-value {
font-size: 36px;
font-weight: 800;
color: #1a73e8;
margin: 10px 0;
}
.pe-interpretation {
font-size: 15px;
color: #555;
line-height: 1.5;
}
.pe-article {
margin-top: 40px;
line-height: 1.6;
color: #444;
}
.pe-article h3 {
color: #222;
margin-top: 25px;
}
.pe-formula-box {
background: #f1f3f4;
padding: 15px;
border-left: 5px solid #1a73e8;
font-family: monospace;
margin: 20px 0;
}
What is the Price-to-Earnings (P/E) Ratio?
The Price-to-Earnings (P/E) ratio is a vital financial metric used by investors to determine the relative value of a company's shares. It measures the relationship between a company's stock price and its earnings per share (EPS). In simple terms, it tells you how much investors are willing to pay for every $1 of the company's earnings.
P/E Ratio = Market Value per Share / Earnings per Share (EPS)
How to Calculate P/E: Step-by-Step
- Find the Current Share Price: Look up the real-time trading price of the stock on any financial news site.
- Determine the EPS: This is found on the company's income statement. It represents the portion of a company's profit allocated to each outstanding share of common stock.
- Divide: Divide the Share Price by the EPS to get your ratio.
Example Calculation
Imagine Company Alpha is currently trading at $100 per share. If their total earnings over the last 12 months divided by the number of shares equals $5.00 (EPS), the calculation would be:
$100 / $5 = 20
This means the P/E ratio is 20, or that investors are paying $20 for every $1 of annual earnings.
Interpreting the Results
- High P/E: Could mean the stock is overvalued, or that investors are expecting high growth rates in the future.
- Low P/E: Could indicate the stock is undervalued, or that the company is performing poorly relative to its historical trends.
- N/A or Negative: If a company has no earnings or is losing money, the P/E ratio is typically expressed as "N/A" (Not Applicable).
function calculatePERatio() {
var sharePrice = parseFloat(document.getElementById('sharePrice').value);
var eps = parseFloat(document.getElementById('eps').value);
var resultBox = document.getElementById('peResultBox');
var resultDisplay = document.getElementById('peResult');
var analysisDisplay = document.getElementById('peAnalysis');
if (isNaN(sharePrice) || isNaN(eps) || sharePrice <= 0) {
alert("Please enter valid positive numbers for the share price and earnings.");
return;
}
resultBox.style.display = 'block';
if (eps <= 0) {
resultDisplay.innerHTML = "N/A";
analysisDisplay.innerHTML = "The P/E ratio is not applicable for companies with zero or negative earnings (losses).";
return;
}
var peRatio = sharePrice / eps;
resultDisplay.innerHTML = peRatio.toFixed(2);
var interpretation = "";
if (peRatio = 10 && peRatio <= 25) {
interpretation = "This is a moderate P/E ratio, typical for many established companies in the current market.";
} else {
interpretation = "This is a high P/E ratio, suggesting investors expect significant future growth or the stock may be overvalued.";
}
analysisDisplay.innerHTML = interpretation;
}