Skip to main content

Bicep Formatter & Validator

Format and validate Azure Bicep infrastructure-as-code templates — re-indent resource, module, param and output declarations to consistent 2- or 4-space nesting, and catch unbalanced brackets, unterminated strings/comments and unexpected top-level statements.

Input

Drop a file or browse
One file · text
Or

Output

Formatted Bicep
 
Validation Issues
LineSeverityMessage
No data yet
Was this helpful?

Guides

Paste a Bicep resource template with inconsistent or missing indentation and get back a cleanly nested, consistently indented version — right in your browser, with nothing uploaded to a server. The Bicep Formatter & Validator re-indents param, var, resource, module, output and type declarations to a consistent 2- or 4-space nesting, and flags basic structural problems: unbalanced brackets, a string that can't legally span a line, an unterminated comment, or a stray top-level statement.

It's built for the moments you don't have the Bicep CLI or the VS Code extension handy: a template pasted from a pull request, a snippet copied out of documentation or an AI assistant with flattened or mixed-up indentation, or a quick sanity check before you paste something back into your editor.

How to use it

  1. Paste your Bicep template into the input box, or upload a .bicep file.
  2. Optionally switch Indent Size between 2 and 4 spaces.
  3. Copy the formatted result, or download it as main.bicep.

Formatting runs automatically as you type or change an option, so you see the result immediately. A separate Validation Issues table lists anything found — or confirms there's nothing wrong.

What it does

  • Consistent indentation, computed from actual bracket nesting rather than from whatever indentation the source happened to have — a template with zero indentation formats exactly the same as one that was already tidy.
  • Decorators and loop expressions "hug" correctly. @allowed([...]) and a loop-comprehension resource's = [for item in items: {...}] open two brackets on one line but only ever indent their contents by one level, matching how the real Bicep formatter treats them — not a naive one-indent-per-bracket count.
  • Strings and comments are left alone. Brackets inside a string — including a ${...} interpolation, which can itself nest further strings and expressions — never affect indentation. A '''...''' multi-line string or a /* ... */ block comment is preserved byte-for-byte once it starts, rather than risking corrupting literal content.
  • Nothing is reordered. Property order, spacing within a line, and every value are left exactly as written — only leading whitespace changes.
  • Basic validation: unbalanced { } / [ ] / ( ), a plain '...' string that hits a raw newline (only ''' strings may span lines), an unterminated block comment, and a top-level line that doesn't start with a recognized declaration keyword (param, var, resource, module, output, type, func, targetScope, metadata, import, extension, using, provider).

Privacy

Everything happens client-side in your browser. Your template is never uploaded to a server — paste one with real subscription IDs or resource names and it never leaves your machine.

Does this replace the Bicep CLI's bicep format?

For fixing indentation and catching the four or five basic mistakes above, yes. It doesn't type-check property names against Azure's resource schemas, resolve module references, or evaluate expressions — that's what bicep build/bicep lint (which need the .NET-based Bicep CLI) are for.

Will it break my template?

The formatter only changes leading whitespace — it never touches property order, values, or interior spacing. When it finds a structural problem it can't safely reformat around (an unbalanced bracket, an unterminated string), it leaves your input untouched and reports the problem in the Validation Issues table instead of guessing.

Related tools

azurearm templateinfrastructure as codeiacazure resource managercloud deploymentdevopsazure cli

Use it from code

From 3 credits per call

REST API

curl -X POST https://api.iotools.cloud/v1/tool/bicep-formatter-validator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "bicepInput": "@description('Name of the storage account')\npara…",
    "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 `bicep-formatter-validator` tool (Bicep Formatter & Validator) on this input:

YOUR_INPUT_HERE

Paste this at any agent connected to the IOTools MCP server, then add your input.

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.