The rate of a chemical reaction indicates how quickly reactants are converted into products. It's typically expressed as the change in concentration of a reactant or product per unit of time. The general formula for the rate of a reaction is:
Rate = (Change in Concentration) / (Change in Time)
This calculator helps you determine this rate given the initial and final concentrations of a substance and the time elapsed.
.reaction-rate-calculator {
font-family: sans-serif;
border: 1px solid #ccc;
padding: 20px;
border-radius: 8px;
max-width: 400px;
margin: 20px auto;
background-color: #f9f9f9;
}
.reaction-rate-calculator h2 {
text-align: center;
color: #333;
margin-bottom: 20px;
}
.reaction-rate-calculator p {
margin-bottom: 15px;
line-height: 1.5;
color: #555;
}
.reaction-rate-calculator .input-section {
margin-bottom: 15px;
display: flex;
align-items: center;
}
.reaction-rate-calculator label {
flex: 1;
margin-right: 10px;
font-weight: bold;
color: #444;
}
.reaction-rate-calculator input[type="number"] {
flex: 1.5;
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
box-sizing: border-box;
}
.reaction-rate-calculator button {
display: block;
width: 100%;
padding: 10px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.reaction-rate-calculator button:hover {
background-color: #0056b3;
}
.reaction-rate-calculator .result-section {
margin-top: 20px;
padding: 15px;
background-color: #e9ecef;
border: 1px solid #ced4da;
border-radius: 4px;
text-align: center;
font-size: 1.1em;
color: #333;
font-weight: bold;
}
function calculateReactionRate() {
var initialConcentration = parseFloat(document.getElementById("initialConcentration").value);
var finalConcentration = parseFloat(document.getElementById("finalConcentration").value);
var timeElapsed = parseFloat(document.getElementById("timeElapsed").value);
var resultDiv = document.getElementById("result");
if (isNaN(initialConcentration) || isNaN(finalConcentration) || isNaN(timeElapsed)) {
resultDiv.innerHTML = "Please enter valid numbers for all fields.";
return;
}
if (timeElapsed 0) {
rateType = "Rate of Formation";
} else if (changeInConcentration < 0) {
rateType = "Rate of Disappearance";
// Display the magnitude of the rate of disappearance as a positive value
reactionRate = Math.abs(reactionRate);
}
resultDiv.innerHTML = "The " + rateType + " is: " + reactionRate.toFixed(4) + " M/s";
}