CUE Formatter & Validator
Format, validate and evaluate CUE (cuelang.org) configuration — reindent structs and lists, catch syntax errors with a line number, resolve concrete fields to their JSON values, and see at a glance which fields are fixed values versus open constraints/schema. Runs entirely in your browser.
Input
Output
| Line | Severity | Message |
|---|---|---|
| No data yet | ||
| Field | Kind | Value / constraint |
|---|---|---|
| No data yet | ||
Guides
Paste CUE configuration and get back a consistently indented, correctly formatted version, a line-numbered syntax check, and a best-effort evaluation of every field that resolves to a concrete value — all in your browser, with nothing uploaded anywhere. The CUE Formatter & Validator also shows, field by field, which parts of your document are fixed values and which are still open constraints or schema.
CUE's constraint syntax — disjunctions (|), conjunctions (&), bound comparisons (>=0 & <=100), and structural typing — doesn't round-trip cleanly through a generic JSON/YAML formatter or an AI assistant's guess at "reasonable" spacing. This tool understands that syntax directly, without needing the cue CLI installed.
How to use it
- Paste your CUE source into the input box.
- Optionally switch Indent Size between 2 and 4 spaces.
- Read the Validation table for any syntax error (with a line number), the Value vs. schema table to see which fields are already concrete, and the Evaluated JSON panel for the resolved output.
Everything reruns automatically as you type.
What it does
- Formats structs, lists, definitions (
#Foo), hidden fields (_foo), optional fields (foo?:), pattern-constraint labels ([string]: int), and thepackageclause, re-indenting by actual nesting depth. Comments (//, leading and trailing) and blank-line spacing are preserved. - Validates syntax and reports the first problem with an exact line number — an unbalanced bracket, an unterminated string, or a value where CUE expects one.
- Evaluates literal values (strings, numbers — including hex/octal/binary and the
Ki/Mi/Gi/K/M/G… size suffixes — booleans, null, structs and lists of the same) and simple+ - * /arithmetic to their concrete JSON equivalent. - Distinguishes value from schema. A field like
port: 8080resolves to a real value; a field likereplicas: >=1 & <=10orenv: "prod" | "staging"is a constraint with no single value yet — the Value vs. schema table calls that out per field (including inside nested structs), and the Evaluated JSON panel marks any field it can't resolve with a⟨constraint: …⟩placeholder instead of guessing.
What it doesn't do
This isn't a reimplementation of CUE's unification engine — it resolves literal values and simple arithmetic, not general constraint solving (#Point & {x: 0, y: 0} stays a constraint, since the tool doesn't merge struct definitions). import declarations, comprehensions (if/for) and let clauses, and hash-strings (#"…"#) aren't supported and are reported as a syntax error rather than silently mishandled. A triple-quoted string's common leading indentation isn't stripped the way real cue fmt strips it.
Privacy
Everything runs client-side in your browser — your configuration is never uploaded to a server.
Why not just use cue fmt?
If you have the CUE CLI installed, it's the authoritative formatter and does full type-checking. This tool is for when you don't — a snippet from a pull request, a config an AI assistant produced with mangled constraint syntax, or a quick check before you paste something into a Kubernetes manifest or a Dagger pipeline.
Why does my field show a ⟨constraint: …⟩ placeholder instead of a value?
That field isn't concrete yet — it's a disjunction, a bound, a reference to another field, or a type like string/int used as a schema. The Value vs. schema table shows the exact constraint text so you can see what's still open.
Related tools
- Kubernetes YAML Formatter — for the YAML manifests CUE configs are often compiled into.
- JSON Schema Validator — a different way to describe and check the shape of JSON/YAML data.
- TOML Formatter — the same kind of formatting for another config language.
More ways to use this tool
REST API
curl -X POST https://api.iotools.cloud/v1/tool/cue-formatter-validator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"cueInput": "package config\n\n// Service configuration\nname: …",
"indentSize": "2"
}'Swap in your own key from your account. The tool's fields are the body — no wrapper.
Ask an AI agent
Use the IOTools `cue-formatter-validator` tool (CUE Formatter & Validator) on this input:
YOUR_INPUT_HEREPaste this at any agent connected to the IOTools MCP server, then add your input.
Embed widget
<iframe
src="https://iotools.cloud/embed/cue-formatter-validator/"
width="100%" height="520" frameborder="0" scrolling="no" loading="lazy"
title="CUE Formatter & Validator — iotools.cloud"
sandbox="allow-scripts allow-forms allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox"
allow="clipboard-write"
style="width:100%;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden"></iframe>
<script src="https://iotools.cloud/embed.js" async></script>Drop this into your own page — free, no key required, just a link back.
| Cost per call | From 5 credits |
|---|