Short answer: not blindly, no. I've dealt with this exact issue on a few client sites and "unused CSS/JS" flagged by an audit tool doesn't always mean "safe to delete."
Here's the thing most people miss: tools like PageSpeed Insights or Lighthouse flag code as "unused" based on what loaded on the specific page they scanned. But a lot of that CSS or JS might be used elsewhere on the site. Maybe it's for a mobile menu that only triggers below a certain screen width, a popup that fires after 30 seconds, an accordion on a different page, or a plugin script that only activates on the checkout page. If you strip it out because the audit said "unused," you can end up breaking layouts or functionality on pages the tool never checked.
So before touching anything, I'd actually test properly instead of trusting a single scan:
Check across multiple pages, not just one. Run the audit on your homepage, a blog post, a product/service page, and any interactive pages (forms, checkout, etc). Code unused on one page might be essential on another.
Use browser dev tools to verify. Chrome's Coverage tab (under DevTools > More tools > Coverage) is honestly more reliable than most audit reports. It shows you real time what's being used as you interact with the page, including things that only load on click, scroll, or hover.
Separate "unused" from "render blocking." These get lumped together a lot, but they're different problems. Something might be used but poorly loaded, meaning it's blocking your initial render even though you need it further down the page. That's a loading order fix, not a deletion.
Look at where the code is coming from. If it's from a theme, plugin, or third party script (Google Fonts, tracking pixels, chat widgets, etc), removing it isn't as simple as deleting a line. You either need to fix it at the source, replace the plugin, or conditionally load it only on pages where it's actually needed.
For the SEO angle: unused CSS and JS don't directly hurt rankings, but they hurt Core Web Vitals (LCP, TBT, CLS), and Google does use page experience signals in ranking, especially for competitive queries. So it's less "Google penalizes you for messy code" and more "messy code slows down your site, and slow sites tend to rank and convert worse."
What's actually worked for me:
- Minify and combine files where possible instead of deleting them outright
- Defer or async load non critical JS (things like chat widgets, non essential trackers)
- Load CSS conditionally, meaning page specific styles shouldn't load sitewide
- Test in a staging environment first, always. Never edit this stuff directly on a live site
- After any changes, recheck the page manually (not just the audit score) to confirm nothing visually broke
So my rule of thumb: treat "unused CSS/JS" audits as a starting point for investigation, not a to do list. Some of it genuinely can go. Some of it just needs to load smarter. The mistake is treating every red flag in an audit tool as an instruction to delete.