developer Tools

Regex Visualizer

Visualize regular expressions as interactive railroad diagrams. Instantly understand complex patterns with a clear, readable SVG diagram.

Runs 100% in your browser — your data never leaves this device

Find this tool useful? Support the project to keep it free!

Buy me a coffee

What is Regex Visualizer?

The Regex Visualizer converts any regular expression into a railroad (syntax) diagram — a visual flowchart that shows how the engine reads your pattern step by step. Instead of parsing cryptic symbols, you see each component (literals, groups, quantifiers, alternations) laid out as a path through a diagram, making complex patterns immediately understandable.

How to Use Regex Visualizer

1. Type or paste your regex in the input field (without surrounding slashes) 2. Optionally select flags (g, i, m, s, u) 3. The railroad diagram updates live as you type 4. Hover over diagram nodes to see what each part matches 5. Use the test input to validate matches in real time

Common Use Cases

  • Learning regex by visualizing what each token does
  • Debugging complex patterns that behave unexpectedly
  • Documenting regex patterns for teammates
  • Teaching regular expressions in workshops or blog posts
  • Verifying alternation branches and quantifier scope

Frequently Asked Questions

What regex syntax is supported?

The visualizer supports the JavaScript RegExp engine: character classes, quantifiers (*, +, ?, {n,m}), groups (capturing, non-capturing, lookahead, lookbehind), alternation (|), anchors (^, $, \b), and backreferences.

Is my regex sent to a server?

No. All parsing and diagram rendering happens entirely in your browser. Your patterns never leave your device.

What are railroad diagrams?

Railroad diagrams (also called syntax diagrams) show a grammar as a directed graph where the valid paths through the diagram represent valid strings. They were originally used to document programming language grammars.

Can I share my regex with the diagram?

Yes — the page URL auto-updates with your regex encoded in the hash, so you can copy and share the URL directly.