Create a Simple Interest Calculator using HTML CSS and JavaScript Last Updated : 28 Apr, 2025 Comments Improve Suggest changes Like Article Like Report Simple Interest is the term used to describe the rate at which money is borrowed or lent. Simple Interest Calculator serves as a practical tool for computing interest on loans or savings without compounding. It allows you to determine the simple interest on the principal amount, offering flexibility in calculating daily, monthly, or yearly interest. In this article, we will create a simple yet effective Simple Interest calculator using HTML, CSS, and JavaScript. Preview ApproachCreate the HTML structure for the calculator with labeled input fields for initial Principal Amount, interest rate, investment years, and a calculate button.Apply CSS styles to enhance the visual appeal of the calculator, focusing on a clean layout, readable fonts, etc.Initialize the JavaScript by adding an event listener to ensure the DOM is fully loaded before interacting with elements.Use JavaScript to retrieve user input values from the input fields for initial investment, interest rate, and investment years.Implement the Simple Interset logic in JavaScript to compute the future value of the investment based on the provided inputs.Update the HTML content dynamically with the calculated result, informing the user about the future value of their investment. Example: In this example, we will design a Simple Interest calculator using HTML CSS, and JavaScript. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>The Investment Calculator</title> <link rel="stylesheet" href="style.css"> </head> <body> <div class="container"> <h1>Investment Calculator</h1> <div class="input-container"> <label for="initial-investment"> Initial Investment ($): </label> <input type="number" id="initial-investment" placeholder="Enter initial investment"> </div> <div class="input-container"> <label for="interest-rate"> Annual Interest Rate (%): </label> <input type="number" id="interest-rate" placeholder="Enter annual interest rate"> </div> <div class="input-container"> <label for="investment-years"> Number of Years: </label> <input type="number" id="investment-years" placeholder="Enter number of years"> </div> <button id="calculate-button"> Calculate </button> <div id="result" class="result-container"> </div> </div> <script src="script.js"></script> </body> </html> CSS body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f4f4; margin: 0; padding: 0; display: flex; align-items: center; justify-content: center; height: 100vh; } .container { background-color: #fff; border-radius: 10px; box-shadow: 0 0 20px rgba(0, 0, 0, 0.2); padding: 40px; width: 400px; display: flex; flex-direction: column; text-align: center; } h1 { color: #007bff; margin-bottom: 20px; } .input-container { margin-bottom: 20px; } label { display: block; margin-bottom: 5px; color: #333; font-weight: bold; } input[type="number"] { width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; margin-top: 5px; } button { background-color: #007bff; color: #fff; border: none; padding: 12px 20px; cursor: pointer; border-radius: 5px; font-size: 16px; margin-top: 10px; } button:hover { background-color: #0056b3; } .result-container { text-align: center; margin-top: 20px; font-size: 18px; color: #333; } JavaScript document.addEventListener("DOMContentLoaded", function () { const button = document.getElementById("calculate-button"); const container = document.getElementById("result"); button.addEventListener("click", function () { const initialInvestment = parseFloat(document.getElementById("initial-investment").value); const interestRate = parseFloat(document.getElementById("interest-rate").value) / 100; const investmentYears = parseInt(document.getElementById("investment-years").value); let totalAmount = initialInvestment; for (let i = 1; i <= investmentYears; i++) { totalAmount *= (1 + interestRate); } container.innerHTML = `After ${investmentYears} years, your investment`+ ` will be worth $${totalAmount.toFixed(2)}.`; }); }); Output: Comment More infoAdvertise with us Next Article CGPA Calculator using HTML CSS & JavaScript M maha123 Follow Improve Article Tags : JavaScript JavaScript-Projects Geeks Premier League 2023 Similar Reads HTML Calculator HTML calculator is used for performing basic mathematical operations like Addition, subtraction, multiplication, and division.You can find the live preview below, try it: To design the basic calculator, we will use HTML , CSS , and JavaScript . HTML is used to design the basic structure of the calcu 3 min read JavaScript Calculator To build a simple calculator using JavaScript, we need to handle basic arithmetic operations such as addition, subtraction, multiplication, and division. JavaScript, along with HTML and CSS, is commonly used to create interactive web-based calculators.What We Are Going to CreateWe will build a simpl 7 min read JavaScript Scientific Calculator The HTML Scientific Calculator is a tool for performing advanced scientific calculations like finding exponents, logarithms, factorials, and more. This calculator comprises two sections: the input section, where the user types in their mathematical problem, and the output screen, which displays all 4 min read JavaScript Neumorphism Effect Calculator In this article, we will learn how to create a working calculator with the Neumorphism effect using HTML, CSS, and JavaScript. Basic mathematical operations such as addition, subtraction, multiplication, and division can be performed using this calculator. Approach: Neumorphism is a contemporary app 3 min read JavaScript Age Calculator In the Age Calculator, the user enters their date of birth using a date input field. The tool calculates and displays the exact age in years, months, and days from the current date (or a specified date). We'll design the layout using HTML and CSS, and add functionality using JavaScript. It will also 3 min read JavaScript Tip Calculator The tip is the money given as a gift for good service to the person who serves you in a restaurant. In this project, a simple tip calculator is made that takes the billing amount, type of service, and the number of persons as input. As per the three inputs, it generates a tip for the serving person. 4 min read JavaScript Geometry Calculator In this article, we will see how to design a Geometry Calculator using HTML, CSS, and JavaScript. A Geometry calculator is used to calculate the area and parameters of different shapes and figures, like circles, rectangles, squares, triangles, etc. This can be helpful in cases where one wants to cal 4 min read JavaScript Aspect Ratio Calculator In this article, we are going to implement an aspect ratio calculator. An aspect ratio calculator proves to be a useful tool for individuals seeking to determine the proportions of images or videos based on their width and height. Our aspect ratio calculator has a live preview option that enables us 5 min read JavaScript Binary Calculator HTML or HyperText Markup Language along with CSS (Cascading Stylesheet) and JavaScript can be used to develop interactive user applications that can perform certain functionalities. Similarly, a binary calculator can be developed using HTML, CSS, and JS altogether. Binary Calculator performs arithme 5 min read JavaScript Percentage Calculator The percentage calculator is useful for students, shopkeepers, and for solving basic mathematical problems related to percentages. In this article, we are going to learn, how to make a percentage calculator using HTML CSS, and JavaScriptFormula used:What is X percent of Y is given by the formula: X 3 min read JavaScript Profit and Loss Calculator In this article, we will create a profit & loss calculator using HTML, CSS & Javascript for adding the basic functionality along with adding the design and layout. Profit and Loss Calculator is basically used to calculate the amount or percentage received after selling a particular price or 3 min read JavaScript BMI Calculator A BMI (Body Mass Index) Calculator measures body fat based on weight and height, providing a numerical value to categorize individuals as underweight, normal weight, overweight, or obese. Itâs widely used to assess health risks and guide lifestyle or medical decisions.A BMI Calculator using JavaScri 3 min read JavaScript Temperature Calculator In this article, we will see Temperature Conversion between Celsius, Fahrenheit & Kelvin using HTML CSS & JavaScript. The Temperature is generally measured in terms of unit degree., i.e. in degrees centigrade, in degrees, Fahrenheit & Kelvin. Celsius is a standard unit of temperature on 3 min read JavaScript Student Grade Calculator A Student Grade Calculator is a tool used to compute students' grades based on their scores in various assessments, such as assignments, quizzes, exams, or projects. It helps standardize grading, ensures accuracy, and provides students with a clear understanding of their academic performance.Formula 4 min read JavaScript Loan Calculator The Loan Calculator can be used to calculate the monthly EMI of the loan by taking the total amount, months to repay, and the rate of interest.Formula Used:interest = (amount * (rate * 0.01))/months;total = ((amount/months) + interest);ApproachExtract values from HTML input elements (#amount, #rate, 2 min read JavaScript Interest Calculator Simple Interest is the term used to describe the rate at which money is borrowed or lent. Simple Interest Calculator serves as a practical tool for computing interest on loans or savings without compounding. It allows you to determine the simple interest on the principal amount, offering flexibility 3 min read JavaScript CGPA Calculator Nowadays, colleges use grades like A, B, C, D, and F, and assign credits to courses. In this calculator, you just need to input your subject name, grade, and credit. We'll also include options to update or delete information in case of mistakes. This way, you won't have to re-enter all details if yo 4 min read JavaScript Bartletts Test Calculator In this article, we are going to implement Bartlett's test calculator in JavaScript. Bartlett's test is a statistical test used to determine whether the variances of multiple groups are homogeneous and plays a crucial role in various fields of experimental research such as analysis of variance and h 3 min read JavaScript Unit Converter In this article, we will be developing an interactive and styled unit converter using HTML, CSS, and JavaScript.In this application, we have a select category option box in which different types of units are specified, like temperature, area, weight, length, and time. As per the user selection, the 7 min read JavaScript Length Converter In this article, we will learn how to create a length converter using HTML, CSS, and JavaScript. The Length Converter is an intuitive web-based application that eliminates the complexities associated with manual conversions. Its user-friendly interface allows users to input a numerical value and sel 6 min read Like