WGSL Validator

Validate WebGPU shader code with the real compiler in your browser. Real errors, real line numbers.

Why validate with the real compiler?

Most online shader checkers re-implement a grammar in JavaScript and drift out of date as the language evolves. WGSL is still evolving, and the ground truth is the compiler inside the browser itself. This tool feeds your code to createShaderModule and reads back getCompilationInfo(), exactly the path your own WebGPU app takes, so the messages you see are the messages your users' browsers would produce: error, warning or info, each pinned to a line and column.

A clean compile means the language is correct. It does not certify your pipeline: entry points, bind group layouts, buffer usages and adapter features get checked later, when you create pipelines and submit work. Pair this validator with our WebGPU Test to see exactly which features and limits your target devices expose.

Common WGSL mistakes this catches

Missing semicolons and unclosed braces; using let where a mutable var is required; integer/float mismatches such as comparing a u32 index with a float literal; wrong workgroup sizes; misspelled builtins; and address-space errors when writing to a read-only storage buffer. The broken sample button loads a shader with several of these planted, so you can see the output format before pasting your own code.

How to use this validator

  1. Paste your WGSL into the editor, or try the broken sample to see a failing report.
  2. Click Validate WGSL. Your browser compiles the module locally.
  3. Read the compiler messages: each shows its type, line and column, and the compiler's own wording.
  4. Fix, re-validate, repeat. Nothing you paste leaves this tab.

Frequently Asked Questions

What is WGSL?

WGSL (WebGPU Shading Language) is the shader language of WebGPU. You write vertex, fragment and compute shaders in WGSL, and the browser compiles them down to the native language of the platform underneath, such as Metal Shading Language, HLSL or SPIR-V.

How does this validator check my code?

It hands your code to your own browser's WebGPU implementation (createShaderModule plus getCompilationInfo), the same compiler your WebGPU app would hit at runtime. The errors and warnings shown are the compiler's real messages with line and column numbers, not a JavaScript approximation of the grammar.

Why does the validator need WebGPU support?

Because honest validation means running the real compiler, and the compiler only exists inside a WebGPU-capable browser and device. If WebGPU is unavailable here, the page says so plainly instead of guessing. Check your setup with our WebGPU Test, or open this page in current Chrome or Edge.

Does valid WGSL guarantee my app runs everywhere?

No. A shader can compile cleanly and still use an entry point, binding or feature a specific adapter lacks, and pipeline creation adds its own checks on top of compilation. Treat a clean validation as "the language is correct", then test pipelines on real devices for the rest.

Is my shader code uploaded anywhere?

No. Compilation happens in your browser tab with the standard WebGPU API. Your code never leaves your device.

Was this tool helpful?

Comments

Loading comments...

Check Out Other Popular Tools