Amps to Kilowatts (kW) Calculator Using JavaScript With HTML

Hello Friends Today, through this tutorial, I will tell you How to Create Amps to Kilowatts (kW) Calculator Using JavaScript with HTML? Below is a simple Amps to Kilowatts (kW) calculator using JavaScript with HTML. This example assumes a standard voltage of 120V, but you can adjust it based on your specific requirements:

INDEX.HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Amps to Kilowatts Calculator</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
label {
display: block;
margin-bottom: 8px;
}
input {
width: 100%;
padding: 8px;
margin-bottom: 16px;
box-sizing: border-box;
}
button {
background-color: #4CAF50;
color: white;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
p {
font-weight: bold;
}
</style>
</head>
<body>
<h2>Amps to Kilowatts Calculator</h2>
<label for="amps">Enter Amperage (A):</label>
<input type="number" id="amps" placeholder="Enter amperage">
<button onclick="calculateKilowatts()">Calculate Kilowatts</button>
<p id="result"></p>
<script>
function calculateKilowatts() {
// Get the amperage input value
const amps = parseFloat(document.getElementById('amps').value);
// Standard voltage (adjust as needed)
const voltage = 120;
// Calculate power (kW)
const powerKW = (amps * voltage) / 1000;
// Display the result
document.getElementById('result').innerHTML = `Power (kW): ${powerKW.toFixed(3)} kW`;
}
</script>
</body>
</html>

This HTML file includes an input field for entering amperage, a button to trigger the calculation, and a result paragraph to display the calculated power in kilowatts (kW). The `calculateKilowatts` function is called when the button is clicked, and it performs the calculation based on the entered amperage and standard voltage. Adjust the voltage variable according to your specific application.

Example:-

Amps to Kilowatts Calculator