webdevpuneet.com

HTTP Status Code Reference — Free HTML CSS JS Snippet

HTTP Status Code Reference · Dev · Plain HTML, CSS & JS · Live preview

Category🛠 Dev

Copy & paste

Source Code

<div class="wrap">
  <div class="header">
    <h2>HTTP Status Codes</h2>
    <span class="count" id="result-count"></span>
  </div>

  <input type="text" id="search-input" placeholder="Search by code, name, or keyword (e.g. 404, redirect, auth)..." spellcheck="false" />

  <div class="filters" id="filters">
    <button class="filter-btn active" data-cat="all">All</button>
    <button class="filter-btn" data-cat="1">1xx Informational</button>
    <button class="filter-btn" data-cat="2">2xx Success</button>
    <button class="filter-btn" data-cat="3">3xx Redirection</button>
    <button class="filter-btn" data-cat="4">4xx Client Error</button>
    <button class="filter-btn" data-cat="5">5xx Server Error</button>
  </div>

  <div class="list" id="list"></div>
</div>

Extend with AI

Take This Snippet Further With AI

The AI prompt for this one is for Patreon supporters ($3 a month, 7 days free), along with a site with no ads. Supporters enter the passcode once and it is remembered in this browser.

· Become a supporter

What's included

Features

Full 1xx-5xx status code coverage with concise, RFC-accurate descriptions
Live multi-field search across code number, name, and description text
Category filter buttons (1xx-5xx) combinable with the free-text search
Color-coded status codes matching the convention used in browser dev tools
Click-to-copy any row as "code name" via the Clipboard API with visual confirmation
Graceful fallback when the Clipboard API is unavailable
Result counter showing how many codes match the current filter
Pure static JavaScript array — no network request, works fully offline
Easily extendable with custom or proprietary status codes

About this UI Snippet

HTTP Status Code Reference — Searchable 1xx-5xx Lookup Table with Click-to-Copy

Screenshot of the HTTP Status Code Reference snippet rendered live

Every developer eventually forgets the exact difference between a 401 and a 403, or whether a 307 preserves the request method during a redirect while a 302 technically does not always guarantee it. This snippet is a self-contained, searchable reference table covering the full range of standard HTTP status codes from informational 1xx responses through server error 5xx responses, built entirely from a static JavaScript array with no network request and no external API — everything renders instantly and works offline.

The data model

The core of the tool is the STATUS_CODES array, where each entry is a plain object with code, name, and desc fields. Descriptions are written to be accurate and concise, summarizing the relevant RFC 9110 (and predecessor RFC 7231/2616) semantics in a sentence rather than reproducing the full specification text. Because it is just a JavaScript array, extending it with additional or custom status codes — a proprietary 499 Client Closed Request used by some proxies, for instance — is a one-line addition.

Live filtering by category and free text

render() is the single function responsible for producing the visible list. It filters STATUS_CODES against two independent conditions: the active category filter (all, or one of 1 through 5 matching the first digit of the code) and a free-text query matched case-insensitively against the code number, the name, and the description. This means typing "redirect" surfaces every 3xx code even without knowing their numbers, while typing "404" or clicking the "4xx Client Error" filter narrows immediately. Both filters combine with logical AND, so a search term and a category filter can be applied simultaneously.

Category color coding

Each row's code number gets a CSS class derived from categoryClass(), which simply takes the first character of the status code and prefixes it with c (so 404 becomes .c4). This produces the familiar color convention seen in most HTTP tooling and browser dev tools — blue for informational, green for success, amber for redirection, red for client errors, and purple for server errors — giving an instant visual read of a code's category before even reading the number.

Click-to-copy for pasting into code or documentation

Clicking any row calls navigator.clipboard.writeText() with a formatted string like "404 Not Found", useful for pasting directly into a commit message, a code comment, or an API error response body. The button briefly shows a "Copied!" confirmation and a green border via the .copied class, then reverts after 1.1 seconds. A fallback path runs the same visual confirmation even if the Clipboard API is unavailable (for example in a restricted iframe), so the interaction never silently fails.

Why this beats a static cheat sheet

A printed or static HTML table of status codes requires scanning through potentially 40 rows to find the one you want. Combining a live text filter with category buttons turns that into a two-keystroke lookup: type part of what you remember (the number, a fragment of the name, or even a keyword from the description like "rate limit" for 429) and the matching rows are the only ones left. That single interaction — search-as-you-type against multiple fields at once — is the same pattern worth reusing for any reference table where users often remember only a fragment of what they are looking for.

Step by step

How to Use

  1. 1
    Browse the full listAll standard HTTP status codes from 100 to 505 are listed by default, grouped visually by category color.
  2. 2
    Search by code, name, or keywordType a number like 404, a name fragment like "redirect", or a concept like "rate limit" — the list filters live against all three fields.
  3. 3
    Filter by categoryClick 1xx, 2xx, 3xx, 4xx, or 5xx to narrow the list to just that class of response, combinable with the search box.
  4. 4
    Click a row to copy itClicking any row copies "code name" (e.g. "429 Too Many Requests") to your clipboard for pasting into code or docs.
  5. 5
    Add your own codesIn the JS panel, add an object with code, name, and desc to the STATUS_CODES array to include custom or proprietary codes.
  6. 6
    Export in your formatClick HTML for a standalone file, JSX for a React component, or Tailwind for a React + Tailwind version.

Real-world uses

Common Use Cases

Debugging API integrations
Quickly look up what a status code returned by a third-party API actually means without leaving your editor or opening a new browser tab to search.
Teaching HTTP fundamentals
Use the category filters to walk through each class of response with students, showing concrete examples of when a server would use a 3xx redirect versus a 4xx client error.
Internal developer documentation
Embed alongside an API response inspector in an internal tools page so engineers have a fast reference while writing error handling code.
Designing consistent API error responses
Search by keyword to choose the most semantically correct status code for a new endpoint, e.g. searching "conflict" to confirm 409 is the right choice over a generic 400.
Code review reference
Quickly verify that a pull request is using the most appropriate status code for a given error condition instead of defaulting everything to 400 or 500.
Related: Regex Tester
See the Regex Tester & Match Visualizer for a related developer utility worth pairing with this one.
Related: Number Base Converter
See the Number Base Converter for a related dev pattern worth pairing with this one.
Related: SHA Hash Generator
See the SHA Hash Generator for a related dev pattern worth pairing with this one.

Got questions?

Frequently Asked Questions

No. All status codes and their descriptions live in a static JavaScript array (STATUS_CODES) inside the snippet itself. There is no network request, so it works fully offline and loads instantly.

The render() function filters STATUS_CODES with a single condition that checks the lowercased query against String(item.code), item.name.toLowerCase(), and item.desc.toLowerCase(), so a match on any of the three fields includes that row.

Yes. The category filter and the text search are two independent conditions combined with logical AND inside the same filter callback, so clicking "4xx Client Error" and then typing "auth" shows only client-error codes whose name or description mentions authentication or authorization.

Clicking a row copies a formatted string of the code and its name, such as "403 Forbidden", to your clipboard via navigator.clipboard.writeText(), useful for pasting directly into code comments or documentation.

Yes. Add a new object with code, name, and desc fields to the STATUS_CODES array in the JS panel. It automatically appears in the list, gets a category color based on its first digit, and becomes searchable.

The descriptions summarize the semantics defined by RFC 9110 and its predecessors (RFC 7231, RFC 2616) in plain language. For legally or contractually precise wording, always refer to the current RFC text directly.