Skip to content

Simple 404 Page

Clean Tailwind CSS 404 error page with an animated unplugged-cable illustration, site search, helpful link cards and a go-back button.

Also known as: 404 page, page not found, error page design, 404 error page, not found page

Tailwind CSS Error Pages Responsive #404 #error-page #responsive #search

Simple 404 Page live demo

Open in new tab

Tailwind CSS code (HTML, CSS, JS)

A friendly 404 error page built with Tailwind CSS and a small vanilla JavaScript helper. A bold "unplugged cable" illustration, a search box and four large destination cards help lost visitors recover instead of leaving the site.

How it works

The root element is main.tnf-page, a full-height flex container that centers the content on a warm amber background. At the top, the .tnf-art inline SVG draws a plug and socket pulled apart; style.css gives it a gentle sway and makes the .tnf-spark lines flicker. Below the heading sits a role="search" form marked data-tnf-search, followed by a role="status" message (data-tnf-status). The "Popular destinations" navigation is a two-column grid of outlined cards that lift and gain a hard offset shadow on hover.

The script runs on DOMContentLoaded for every .tnf-page. It writes window.location.pathname into the [data-tnf-path] code element so visitors see which address failed. The [data-tnf-back] button calls history.back() when there is a referrer and otherwise sends the visitor to the URL in data-tnf-home. Submitting the search form is simulated with a short timeout: an empty query marks the input with aria-invalid and asks for a word; a filled one shows a status message. Without JavaScript the links still work; only the search and the back button do nothing.

Customization

  • bg-amber-50, bg-amber-200 and the #f59e0b value in shadow-[4px_4px_0_0_#f59e0b]: swap for another hue to match your brand.
  • data-tnf-home on the back button: point it at your home page or a sitemap.
  • The search submit handler in script.js: replace the setTimeout with a redirect to your search page (the line is already in a comment above the handler).
  • The four destination cards: change the href, title, hint text and the icon tile color (bg-sky-200, bg-lime-200, bg-rose-200), or add more cards to the sm:grid-cols-2 grid.
  • tnf-flicker and tnf-sway keyframes in style.css: tune or remove the illustration motion.
  • The h1 text "This page came unplugged": adjust the tone, but keep the "ERROR 404" badge so the status stays obvious.

Use cases

  • Any website: replace a dead end with an unplugged-cable illustration and a go-back button
  • Content sites: a search box lets lost visitors look for what they wanted
  • Online stores: four destination cards point to helpful sections
  • Web apps: a friendly message keeps users from leaving after a broken link

Accessibility

The page is a single main landmark labelled by the h1. The search input has a visually hidden label, the destination list is a labelled nav, and arrow and icon SVGs are aria-hidden. Search feedback is announced through the role="status" region. All interactive elements show a thick amber focus ring, and both animations stop under prefers-reduced-motion: reduce.

Usage notes

Remember to return a real HTTP 404 status from your server for this page; the markup alone does not set it.

Simple 404 Page at a glance

Framework
Tailwind CSS
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Tailwind CSS
Layout
Responsive, works on mobile
Category
Error Pages
License
Free for personal and commercial use

Questions about this template

Can I use the Simple 404 Page code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Tailwind CSS from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>

The Tailwind browser build is for prototyping. In production, compile Tailwind with its CLI or your bundler.

Simple 404 Page – free Tailwind CSS error page template
Simple 404 Page · free Tailwind CSS error page template

More Error Pages

500 Server Error Page – free Bootstrap 5 error page template

500 Server Error Page

Dark Bootstrap 5 500 error page with a server rack illustration, retry button, status page link, copyable reference ID and service status list.

Animated 404 Page – free Pure CSS error page template

Animated 404 Page

Playful full-page 404 error template with a floating planet, short message, site search field and home link in pure CSS.