Two‑Value Display Syntax Playground - Online Outer & Inner
Explore the new two‑value display syntax like `display: block flex`. See what each inner/outer pair does visually.
UD5 Toolkit
The URLPattern API is supported in Chrome 95+, Edge 95+, and modern browsers.
Firefox and Safari may have limited support. Please use a Chromium-based browser for the full experience.
Check compatibility
Online Route Matcher & Playground — Test, debug, and experiment with URL patterns instantly
Quick Presets:
:name), wildcards (*), optional segments (?), and even regular expressions. It's particularly useful in service workers, routing libraries, and anywhere you need robust URL matching without complex regex.
new URLPattern('/users/:userId'), then call pattern.test('https://example.com/users/42') to check if it matches. Use pattern.exec(url) to extract captured groups like { userId: '42' }. This makes it perfect for client-side routing, API gateways, and service worker fetch handlers.
/blog/:year/:month/:slug is self-documenting, while the equivalent regex /blog/([^/]+)/([^/]+)/([^/]+) is harder to read. URLPattern also handles edge cases (encoding, empty segments, query strings) automatically. However, if you need extremely fine-grained matching logic beyond URL structure, regex may still be useful.
typeof URLPattern !== 'undefined' to provide fallback logic.
:name syntax in your pattern. When a URL matches, each named group captures the corresponding segment. For example, pattern /users/:userId/posts/:postId matching /users/42/posts/7 yields groups { userId: '42', postId: '7' }. You can also use regex constraints like /users/(\\d+) to ensure only digits match.
/search?:query to capture query parameters, or /page#:section to match hash fragments. You can also match full URLs including protocol and hostname: https://*.example.com/*?utm_source=:source.
* wildcard matches zero or more characters within a URL segment, while ** (not yet widely supported) would match across segments. For example, /files/*.pdf matches /files/report.pdf and /files/summary.pdf, but not /files/sub/report.pdf. To match any sub-path, you can use /files/* which matches /files/anything/here as a single wildcard segment.
new URLPattern({ pathname: '/api/*' }) to intercept API calls, or { pathname: '/images/*.webp' } to handle image caching. This makes service worker code cleaner, more maintainable, and less error-prone.
test(url) returns a simple boolean indicating whether the URL matches the pattern — perfect for quick checks. exec(url) returns a detailed result object (or null if no match) containing all matched components and captured groups. Use test() for filtering/routing decisions, and exec() when you need to extract parameters from the URL.
/dashboard/:tab, URLPattern matches the pathname portion of any URL. You can test it against full URLs (https://app.example.com/dashboard/analytics) or relative paths (/dashboard/analytics). You can also provide a base URL as the second argument to new URLPattern() for resolving relative patterns.
Explore the new two‑value display syntax like `display: block flex`. See what each inner/outer pair does visually.
Write a fragment shader and see the result rendered on a full‑screen quad. For WebGL learners. Local compilation.
Write modern CSS color functions like oklch(), lab(), hwb() and see the rendered color with fallback. Copy compatible code.
Write CSS like `oklch(from red l c h)` to modify colors dynamically. Preview the output and copy the code.
Chain multiple CSS filter functions and see the result on an image. Copy the filter string. No upload.
Practice aligning grid items and tracks with the place‑items, align‑content, and justify‑content properties. Visual guide.
Change all alignment and justification values and see the flex items move. Indispensable for learning Flexbox.
Drag a positioned box and see the top/right/bottom/left values change. Understand containing blocks. Visual.
Type text and instantly see it rendered with text‑transform: uppercase, lowercase, capitalize, and full‑width. Copy CSS.
Set perspective and rotate children in 3D space. See the effect of perspective‑origin. Copy the CSS. Learn 3D transforms.
Click on a box to set the transform‑origin point and see how rotations and scales change. Copy the CSS.
Drag items into grid cells and see the resulting grid‑area or line‑based placement code. Learn how auto‑placement and spanning work.
Drag to resize a box and see the Resize Observer callback fire. Get contentRect and borderBoxSize. Learn the API.
Write CSS like `oklch(from red l c h)` to modify colors. Preview the output and copy. Modern color manipulation.
Write JavaScript using element.animate() and see the result in a live preview. Compare with CSS keyframes. Debugger included.
Write compound selectors and instantly see which elements they match on a test page. Master complex CSS logic.
See every touch point with coordinates, radius, and force on your mobile device. Debug gestures with live overlay.
Write a compute shader in WGSL and run it in the browser. See the output on a canvas. Learn WebGPU. Real‑time compilation.
Type directly into a contenteditable div with real‑time CSS filters, shadows, and colors. Download as HTML. Fun demo.
Create an animation that advances with scroll using animation‑timeline: scroll(). See the visual timeline editor. Modern CSS.
Input any JavaScript object and see if structuredClone can deep‑copy it. Compare with JSON.parse/stringify. Learn transferables.
Write CSS with native nesting (like SCSS) and see the browser’s native parsing. Validator and live output.
Test the powerful :has() pseudo‑class. Write selectors like .card:has(img) and see the live result. Revolutionary for CSS architecture.
Pick two images or colors and apply all 16 CSS mix‑blend‑mode values live. See and copy the right CSS for your design.
Experiment with the CSS color-mix() function. Pick two colors and mix them in different color spaces (srgb, oklch). Copy the CSS.
Interactively add and adjust multiple box shadows on a sample element. Drag sliders for offset, blur, spread, and color. Copy the clean CSS code instantly.
Drag points to create a custom clip‑path shape. See the CSS value update live. For creating non‑rectangular elements.
Experiment with CSS Grid properties visually. Add rows, columns, and areas. See the grid in action and copy the code.
Type any condition and see the result of the ternary operator. Understand truthy/falsy values. Quick learning tool.
Visually experiment with Flexbox container and item properties. See the layout update in real time and copy the CSS. Learn by doing, fully interactive.