Input Python
Paste your code to format it and check its syntax
Options
Adjust formatting and validate
Detect the format on paste. If ambiguous, choose it manually.
Result
Code viewer · Read only
Format and validate Python online
Format .py files with Ruff in your browser. Check syntax and preserve indentation structure. Does not execute Python, install modules or check dependencies.
How to use the formatter
- Paste your code in the editor. JSON is the default format on the home page.
- Enable detection on paste or choose the format manually. HTML and XML can be ambiguous.
- Adjust indentation and select Format or Validate. The viewer includes syntax colors and folding for every format. Minification is available for JSON.
Code example Python
def greet(name):
return {"message":"Hello " + name}
print(greet("Ada"))
Is my code sent to a server?
No. Processing takes place in your browser. Pasted code is neither uploaded nor stored on the server.
What does validation check?
It checks syntax with the selected format’s parser. It does not execute code or guarantee that a program works correctly. If there is an error, fix the input and validate again.