Birthday Reminder App using HTML, CSS, and JavaScript Last Updated : 09 Aug, 2024 Comments Improve Suggest changes Like Article Like Report Birthday reminder app helps us to track the upcoming birthdays of our loved ones so that we don't forget to celebrate them. In this tutorial, we will create a simple Birthday Reminder web app using the power of HTML, CSS, and JavaScript. This app allows users to add birthdays by adding names and birthday dates and showing all birthdays in a list view. It will remind us of birthdays today by showing an alert box. PrerequisitesBasic knowledge of HTML, CSS, and JavaScriptA code editorApproachCreate a section that contains input fields for username and birthday date, along with an "Add" button to add a birthday to the birthday list. Before adding birthdays to the list, we will check if either the name or date field is not empty. If so, we will show an alert box stating that both the name and date should be provided in order to add the birthday to the list.Once there is at least one birthday added, we will display a birthday list.Add style to app to make it captivating.Initialise birthdayList, nameInput, dateInput, image, quote, and box variables to access various HTML elements. Create "addReminder" function to add a new birthday to the list when the user clicks the "Add" button. Add new birthday to the userDetails object in the local storage, and when user loads the application, retrieve birthday list from local storage.Create the function - "checkAndTriggerAlerts" to check if any birthday matches the current date and display alert box. Create a setInterval method calls checkAndTriggerAlerts every second to continuously monitor upcoming birthdays.Example: The below code is the complete implementation of above approach. HTML <!DOCTYPE html> <html> <head> <title>Birthday Reminder App</title> <link rel="stylesheet" href="style.css"> <link rel="stylesheet"href= "https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL, GRAD@24,400,0,0" /> </head> <body> <div class="container"> <h3>Birthday Reminder App</h3> <div class="birthday-input"> <input type="text" class="name-input" placeholder="Name"> <input type="date" class="date-input"> <button onclick="addReminder()" class="add-btn"> <span class="material-symbols-outlined">add</span> </button> </div> <div class="empty-state"> <span>You don't have any birthday reminders, create one!</span> <div class="birthday-cake"> <span class="material-symbols-outlined">cake</span> </div> </div> <ul class="birthday-list"> </ul> </div> <script src="script.js"></script> </body> </html> CSS body { font-family: 'Arial', sans-serif; background-color: #f0f4f8; margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; } .container { background-color: #ffffff; padding: 30px; border-radius: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); text-align: center; width: 100%; max-width: 500px; } h3 { margin-bottom: 20px; font-size: 1.5rem; color: #333; } .birthday-input { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; } .name-input, .date-input { width: 45%; padding: 10px; margin-right: 10px; border: 1px solid #ddd; border-radius: 5px; font-size: 1rem; } .date-input { width: 35%; } .add-btn { background-color: green; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; display: flex; align-items: center; } .add-btn:hover { background-color: #fff; border: 2px solid green; color: green; } .material-symbols-outlined { font-size: 1.5rem; } .empty-state { margin-top: 20px; } .empty-state span { display: block; margin-bottom: 10px; color: #666; font-size: 1rem; } .birthday-cake { font-size: 3rem; color: green; } .birthday-list { margin-top: 20px; list-style-type: none; padding: 0; } .birthday-list-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; border-bottom: 1px solid #ddd; } .birthday-list-item:last-child { border-bottom: none; } .birthday-list-item span { font-size: 1rem; } .delete-btn { background-color: #e74c3c; color: white; border: none; padding: 5px 10px; border-radius: 5px; cursor: pointer; } .delete-btn:hover { background-color: #c0392b; } Javascript const birthdayList = document.querySelector(".birthday-list"); const nameInput = document.querySelector(".name-input"); const dateInput = document.querySelector(".date-input"); const image = document.querySelector(".birthday-cake"); const quote = document.querySelector(".empty-state span"); let usersDetails = JSON.parse(localStorage.getItem('usersDetails')) || []; let id = usersDetails.length ? Math.max(usersDetails.map(user => user.id)) + 1 : 0; const today = new Date(); const formattedDate = `${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, '0')} -${today.getDate().toString().padStart(2, '0')}`; const addReminder = () => { const userName = nameInput.value.trim(); const date = dateInput.value; if (userName && date) { const item = document.createElement("li"); item.className = 'birthday-list-item'; item.innerHTML = ` <span>${userName} - ${date}</span> <button class="delete-btn"> <i class="material-symbols-outlined">delete</i> </button> `; birthdayList.appendChild(item); usersDetails.push({ id: id, name: userName, date: date }); localStorage.setItem('usersDetails', JSON.stringify(usersDetails)); id++; image.style.display = "none"; quote.style.display = "none"; item.querySelector(".delete-btn").addEventListener("click", () => { birthdayList.removeChild(item); usersDetails = usersDetails.filter(user => user.id !== id); localStorage.setItem('usersDetails', JSON.stringify(usersDetails)); if (usersDetails.length === 0) { image.style.display = "block"; quote.style.display = "block"; } }); nameInput.value = ""; dateInput.value = ""; } else { window.alert("Please fill in both the name and birthday date to set a reminder!"); } }; function showAlertNotification(users) { alert(`Reminder: It's ${users.join(', ')}'s birthday today! 🎉`); } function checkAndTriggerAlerts() { let todaysBirthdays = usersDetails.filter(user => user.date === formattedDate) .map(user => user.name); if (todaysBirthdays.length > 0) { showAlertNotification(todaysBirthdays); clearInterval(intervalId); } } function loadReminders() { if (usersDetails.length > 0) { image.style.display = "none"; quote.style.display = "none"; usersDetails.forEach(user => { const item = document.createElement("li"); item.className = 'birthday-list-item'; item.innerHTML = ` <span>${user.name} - ${user.date}</span> <button class="delete-btn"> <i class="material-symbols-outlined">delete</i> </button> `; birthdayList.appendChild(item); item.querySelector(".delete-btn").addEventListener("click", () => { birthdayList.removeChild(item); usersDetails = usersDetails.filter(u => u.id !== user.id); localStorage.setItem('usersDetails', JSON.stringify(usersDetails)); if (usersDetails.length === 0) { image.style.display = "block"; quote.style.display = "block"; } }); }); } } loadReminders(); let intervalId = setInterval(checkAndTriggerAlerts, 1000); Output Comment More infoAdvertise with us Next Article Birthday Reminder App using HTML, CSS, and JavaScript R rn540 Follow Improve Article Tags : HTML Similar Reads HTML Tutorial HTML stands for HyperText Markup Language. It is the standard language used to create and structure content on the web. It tells the web browser how to display text, links, images, and other forms of multimedia on a webpage. HTML sets up the basic structure of a website, and then CSS and JavaScript 11 min read HTML Interview Questions and Answers HTML (HyperText Markup Language) is the foundational language for creating web pages and web applications. Whether you're a fresher or an experienced professional, preparing for an HTML interview requires a solid understanding of both basic and advanced concepts. Below is a curated list of 50+ HTML 14 min read Top 10 Projects For Beginners To Practice HTML and CSS Skills Learning to code is an exciting journey, especially when stepping into the world of programming with HTML and CSSâthe foundation of every website you see today. For most beginners, these two building blocks are the perfect starting point to explore the creative side of web development, designing vis 8 min read HTML Introduction HTML stands for Hyper Text Markup Language, which is the core language used to structure content on the web. It organizes text, images, links, and media using tags and elements that browsers can interpret. As of 2025, over 95% of websites rely on HTML alongside CSS and JavaScript, making it a fundam 6 min read HTML Tags - A to Z List HTML Tags are fundamental elements used to structure and format content on web pages. They provide instructions to web browsers on how to render text, images, links, and other media.HTML tags are enclosed in angle brackets < > and usually come in pairs: an opening tag and a closing tag. The cl 15+ min read HTML DOCTYPE Declaration HTML DOCTYPE (Document Type Declaration) is an instruction that appears at the beginning of an HTML document, before the <html> tag.Its primary role is to tell the web browser which version of HTML the page is written in, ensuring that the browser renders the content correctly. It is not an HT 4 min read 30+ Web Development Projects with Source Code [2025] Web development is one of the most in-demand career paths in the IT industry, experiencing consistent growth of around 20â25% annually. Whether you're a student starting out or an experienced professional looking to switch or advance your career, it's essential to go beyond theory and demonstrate yo 4 min read Frontend Developer Interview Questions and Answers Frontend development is an important part of web applications, and it is used to build dynamic and user-friendly web applications with an interactive user interface (UI). Many companies are hiring skilled Frontend developers with expertise in HTML, CSS, JavaScript, and modern frameworks and librarie 15+ min read HTML Forms HTML forms, defined using the <form> Tags are essential for collecting user input on web pages. They incorporate a variety of interactive controls such as text fields, numeric inputs, email fields, password fields, checkboxes, radio buttons, and submit buttons. Over 85% of websites rely on for 5 min read HTML Tables HTML (HyperText Markup Language) is the standard markup language used to create and structure web pages. It defines the layout of a webpage using elements and tags, allowing for the display of text, images, links, and multimedia content. As the foundation of nearly all websites, HTML is used in over 10 min read Like