Learning how to add dark mode to WordPress is one of the quickest wins you can give your visitors. A dark mode toggle lets readers switch your site to a dark background with light text — easier on the eyes at night and on OLED screens — and takes about ten minutes with a free plugin.
In this guide, we show you how to add dark mode to WordPress four ways: the easiest plugin method, a CSS-only method, a custom code method, and your theme’s own built-in option. No coding is needed for the first method, and every price below was checked on 28 November 2026.

In this guide
- Why Add a Dark Mode Toggle to WordPress?
- Before You Start: Three Quick Decisions
- How to Add Dark Mode to WordPress With a Plugin
- Method 2: Add Dark Mode With CSS Only
- Method 3: Build a Custom Toggle Without a Plugin
- Method 4: Use Your Theme’s Built-In Dark Mode
- The Four Methods Compared
- Customising the Toggle: Position, Style and Colours
- Adding Dark Mode to the WordPress Admin
- Troubleshooting: When Dark Mode Does Not Work
- The Verdict
- Frequently Asked Questions
Why Add a Dark Mode Toggle to WordPress?
A dark mode toggle is a small switch — usually a sun and moon icon — that lets each visitor choose between your light design and a dark version. The choice is remembered for the next visit. That is the core reason to learn how to add dark mode to WordPress: you hand the choice to the reader.
The benefits are practical. Reading bright white pages in a dark room causes eye strain, and a dark background is far gentler late at night; on OLED phones, dark pixels also use less power. A working toggle makes your site feel modern too — visitors judge a site in seconds. One trade-off: a plugin rewrites your colours automatically and does not always get every element right, so test every page type — the fixes are below.
Before You Start: Three Quick Decisions
Before you learn how to add dark mode to WordPress, make three decisions. First, toggle, automatic, or both? A toggle gives visitors a manual switch; automatic mode follows the visitor’s device setting. Best is both — follow the device setting, and let the visitor override it with the toggle.
Second, plugin or code? If you want the result today with no coding, use a plugin. If you want full control over every colour, use code. Most site owners should start with a plugin — it is faster, and you can switch to code later. Third, take a backup before installing a new plugin or editing CSS.
How to Add Dark Mode to WordPress With a Plugin
The plugin method is the fastest way to learn how to add dark mode to WordPress, and the one we recommend for most sites. The free WP Dark Mode plugin does the whole job: a floating toggle, device detection, and a dark admin dashboard.
Step 1: Install WP Dark Mode
Go to Plugins » Add New, search for WP Dark Mode“, then click Install Now and Activate. It is free on WordPress.org: 20,000+ installs, 4.5 out of 5 from about 390 reviews, updated 28 October 2026.
Step 2: Turn on frontend dark mode
Go to WP Dark Mode » Settings in the dashboard menu. Toggle “Enable Frontend Dark Mode” to ON and click Save Changes. Your site now has a dark version, and visitors whose devices prefer dark mode will see it automatically. This single setting is the heart of how to add dark mode to WordPress with a plugin.
Step 3: Show the floating toggle
Switch to the Customization tab, turn on the floating switch, pick a style, and set its position — bottom right is the default. Save, then visit your site in a private window to see the toggle. Visitors can click it to switch modes, and the plugin remembers their choice; Ctrl+Alt+D works too.
Step 4: Place the toggle in your header instead (optional)
To put the switch in your navigation instead, use the Gutenberg block, the Elementor widget, or the shortcode [wp_dark_mode_switch] in your header or a widget area, then turn the floating switch off. Our guide to how to add a menu in WordPress shows how header areas work.
Choosing a different plugin
WP Dark Mode is the most established option, but not the only one. Darkify is a newer alternative whose free version includes scheduling and presets, with Pro from $39/year for a single site. For most sites, the free version is enough.

Method 2: Add Dark Mode With CSS Only
If you do not want another plugin, you can learn how to add dark mode to WordPress with a few lines of CSS. This method follows the visitor’s device setting automatically, but it adds no toggle button — visitors get dark mode only when their device is set to dark.
Go to Appearance » Customize » Additional CSS on a classic theme, or add the CSS to your child theme’s stylesheet. Then add a media query that swaps your colours when the device prefers dark:
@media (prefers-color-scheme: dark) {
body {
background-color: #121212;
color: #e0e0e0;
}
a {
color: #8ab4f8;
}
}
This is only a starting point: you must restyle headers, footers, cards and buttons one by one, which is why this method suits developers best. The advantage is zero extra plugins and zero performance cost; the disadvantage is that every colour change is manual, and no visitor can override their device setting. Our guide to how to add custom CSS to WordPress covers the safe ways to add it — one more way to learn how to add dark mode to WordPress without a plugin.
Method 3: Build a Custom Toggle Without a Plugin
For full control, build your own toggle with a small amount of JavaScript and CSS. This is the most flexible answer to how to add dark mode to WordPress: a real switch visitors can click, their choice remembered, and no plugin at all.
The idea behind this way of learning how to add dark mode to WordPress is simple: a button toggles a dark class on the body element, your CSS styles everything under that class with dark colours, and the choice is saved in the browser so the next visit remembers it. Check the device setting on the first visit too.
Add the button to your header or a widget area, with a clear label or sun/moon icon and an id your script can find — for example, dark-mode-toggle. Then add a small script that toggles the class on click, saves the choice, and reads it back on page load. Put the script and CSS in your child theme so an update does not remove them — see our guide to how to create a WordPress child theme.
Finally, write CSS rules under body.dark for your background, text, links, headers and buttons, and test every page template — a missed element will glow white in an otherwise dark page. This takes an hour or two, but the result is exactly your design.
Method 4: Use Your Theme’s Built-In Dark Mode
Before installing anything, check whether your theme already has dark mode — the easiest version of how to add dark mode to WordPress, because there is nothing to install. Many modern block themes include a dark style variation in the Site Editor, and some premium themes ship a dark mode toggle of their own.
Open Appearance » Editor (or Customize on a classic theme) and look under Styles for a dark variation. Switching to it gives you a dark design made by the theme author — usually the cleanest result. The catch: most built-in options are all-or-nothing, with no toggle for light-mode visitors.
If your theme has no dark option, the plugin method above is quicker. Test a theme’s dark style on a staging copy first: a theme that looks great in light mode can have unreadable buttons in dark mode.
The Four Methods Compared
Each approach to how to add dark mode to WordPress suits a different kind of site. The table sums up the trade-offs.
| Method | Difficulty | Visitor toggle | Follows device setting | Cost | Best for |
|---|---|---|---|---|---|
| Plugin (WP Dark Mode) | Easy | Yes | Yes | Free; paid tier available | Most sites, fastest setup |
| CSS only | Medium | No | Yes | Free | Developers, simple sites |
| Custom code toggle | Advanced | Yes | Yes, if you code it | Free | Full design control |
| Theme built-in | Easy | Rarely | Sometimes | Free (theme feature) | Themes that already offer it |
The pattern is clear: when you weigh up how to add dark mode to WordPress, the plugin method is the only one that is both easy and complete, which is why it is the right default for almost every site. Choose code only when you need pixel-perfect control over the dark palette.
Customising the Toggle: Position, Style and Colours
A toggle that clashes with your design is worse than no toggle, so spend a few minutes on the details once you know how to add dark mode to WordPress. Position matters most: bottom right is the standard spot, clear of your content and cookie banner. Make the switch at least 44 pixels across so it is easy to tap on a phone, and test it on a real phone.
For colours, pick dark grey rather than pure black: #121212 is easier on the eyes than #000000, and light grey text reads better than pure white. Keep your brand colour for links and buttons. If a logo has a white background baked in, lower its brightness in dark mode or swap in a dark-background version.
Adding Dark Mode to the WordPress Admin
Dark mode is not only for your visitors. If you write late at night, a dark admin dashboard is much easier on your eyes, and WP Dark Mode adds it with the same plugin — one more reason to learn how to add dark mode to WordPress with a plugin rather than with CSS alone.
Go to WP Dark Mode » Settings and open the Admin Panel Dark Mode tab. Toggle “Enable Admin Dashboard Dark Mode” to ON and save. A switch appears at the top of your dashboard, and you can also enable dark mode for the block editor. WordPress itself lets you change your admin colour scheme under Users » Profile, but that only recolours the sidebar.

Troubleshooting: When Dark Mode Does Not Work
The toggle does not appear
Check that frontend dark mode is enabled in WP Dark Mode » Settings — the toggle will not show until it is. Then purge your cache: caching plugins and CDNs often serve the old page without the toggle. If it still does not appear, deactivate other plugins one at a time to find a conflict.
Some elements stay white
This is the most common issue people meet when learning how to add dark mode to WordPress: a plugin or theme sets its own background colour with an inline style the dark mode plugin cannot override. Find the rule in your browser’s inspector and add an override in your custom CSS. For images, use a transparent-background logo, swap in a dark-mode image, or lower the brightness.
Dark mode turns on but will not turn off
This is almost always a saved preference: the plugin remembers the visitor’s last choice. Clear the site data for your domain, or click the toggle again — testing in a private window gives you a clean slate.
The site flashes white before going dark
A brief white flash happens when the dark mode script runs after the page paints. It is mostly cosmetic. The plugin’s settings include options to reduce it, and keeping your pages fast helps too — see our WordPress speed guide.
The Verdict
Knowing how to add dark mode to WordPress comes down to one choice: plugin or code. For nearly every site, the plugin method wins — install WP Dark Mode, enable frontend dark mode, turn on the floating toggle, and you are done in ten minutes for $0. Code is worth it only when you want total control over every colour.
Bottom line: How to add dark mode to WordPress in ten minutes: install the free WP Dark Mode plugin, enable frontend dark mode, and turn on the floating toggle. Your visitors get a switch they can use, their choice is remembered, and your site follows their device setting automatically. Test every page template in dark mode before you call it done.
Frequently Asked Questions
Does WordPress have dark mode built in?
WordPress has no built-in frontend dark mode toggle for visitors — that is why learning how to add dark mode to WordPress usually means installing a plugin. The admin area offers colour schemes under Users » Profile, but those only recolour the sidebar.
Is WP Dark Mode free?
Yes. The core plugin is free on WordPress.org, with 20,000+ active installs. The free version includes the floating toggle, device detection, admin dark mode and two colour presets. The paid Ultimate tier adds scheduling and extra styles — check the vendor’s current price first.
Will a dark mode plugin slow down my site?
Barely. A well-built plugin adds a small script and stylesheet — a tiny cost next to a heavy theme or unoptimised images — so learning how to add dark mode to WordPress will not hurt your speed. The CSS-only method adds nothing at all. If your site feels slow afterwards, start with our WordPress speed guide.
Can I add a dark mode toggle without a plugin?
Yes — if you know how to add dark mode to WordPress with code, the CSS-only method uses a prefers-color-scheme media query but adds no toggle, while the custom code method adds a real toggle with a small JavaScript snippet that swaps a class on the page and remembers the choice. Both are free; the custom method takes an hour or two and needs a child theme.
Does dark mode work on mobile?
Yes. Once you know how to add dark mode to WordPress, the floating toggle works on phones and tablets and follows the device setting automatically — if a visitor’s phone is in dark mode, your site opens dark. Test the position on a real phone, since a switch that looks fine on desktop can cover content on a small screen.
Why do some images look wrong in dark mode?
Images with white backgrounds baked in — most often logos — stand out as bright rectangles on a dark page. Use a transparent-background logo, swap in a dark-mode image, or lower the brightness. WP Dark Mode can dim images automatically.
All prices in this guide are in USD and were checked on 28 November 2026. Prices change often — confirm the current price before you buy.