Code tool

CSS Nth Selector Tester

Test bounded CSS :nth-child and related formulas against a fixed sample and see matching positions. No arbitrary CSS is executed.

In-browser processingNo account requiredPrivacy details ↗

Try :nth-child(2n+1), :nth-last-child(2), :nth-of-type(3), or :nth-child(odd). Only the Nth pseudo-class is evaluated.

Enter an Nth selector to highlight matching items.

1div
2li
3div
4li
5div
6li
7div
8li

The sample stays in this browser. The selector is parsed as a bounded formula and is never executed as CSS.

A QUICK WALKTHROUGH

How to use this tool

  1. Enter a supported Nth formula.
  2. Test it against the fixed sample.
  3. Read the highlighted positions.

Supported formulas

Supports :nth-child, :nth-last-child, :nth-of-type, and :nth-last-of-type with odd, even, an+b, or a single integer.

Safe local preview

Only a bounded formula parser runs; user text is never inserted into markup or executed as CSS.

GOOD TO KNOW

Common questions

Which formulas are supported?

The four supported Nth pseudo-classes accept odd, even, an+b, or a single integer.

What does :nth-child(2n+1) select?

It matches odd positions in the fixed sample.

Does the tester execute arbitrary CSS?

No. It parses only the supported formula syntax against a fixed sample.