# How to Add Dark Mode to Any Website in 5 Minutes (with localStorage)
Dark mode isn't just a trend anymore – it's an expected feature. Users want it for better readability and less eye strain.
The good news? You can add it to any existing website in about 5 minutes with pure CSS and a few lines of JavaScript.
No frameworks. No dependencies. Just copy, paste, and customize.
What You'll Build
A complete dark mode toggle that:
✅ Saves user preference in localStorage (persists across visits)
✅ Detects system theme automatically
✅ Lets users override system preference
✅ Works on any existing website
Step 1: CSS Variables (The Foundation)
CSS variables make theme switching effortless.…