robots.txt Formatter (Casing, Spacing, Order)

Rewrites a robots.txt into a consistent layout without changing its meaning, and keeps your comments.

Use the tool

Why this tool exists

Files edited by many people end up with User-agent in three casings, spaces before colons and blank lines in odd places. It still works, but it is hard to review and easy to break.

The formatter normalises directive names, puts a single space after the colon, separates groups with one blank line and can fix misspellings such as Disalow. You can also sort consecutive rule lines by path. Comments stay where they are.

How to use it

  1. Paste the robots.txt.
  2. Choose whether to sort rules and fix typos.
  3. Copy the formatted result.
  4. Validate and test it before you publish.

Frequently asked questions

Does formatting change behaviour?

No. Casing and spacing are not significant, and rule order does not matter for longest-match crawlers.

What does Fix misspelled directives do?

It rewrites known typos such as Disalow to Disallow so every crawler understands them.

Are comments kept?

Yes, in place.

Does it sort groups?

No, only consecutive rule lines inside a group, and only if you ask.