Beautify Code

Beautify and format code using conventions, with support for many popular languages

Tags: beautify code c c# c++ css go html java javascript perl php python ruby sql typescript

Introduction

Welcome to our online code beautification tool! It’s designed to help you format, clean, and organize your code with ease. Whether you're working with markup, front-end, or back-end languages, we've got you covered. Our tool supports 22 popular programming languages, and you can see the full list in the table on the right.

Powered by advanced beautifiers, this tool gives you the flexibility to style your code exactly how you like. We frequently update the beautifiers to ensure you always get the best performance and the latest features.

How to Use It

Getting started is simple:

  1. Paste or Upload Your Code: You can either paste your code directly into the editor or upload a file using the Upload button. Check the supported file types in the list on the right.
  2. Format Your Code: Choose your preferred settings and let the tool work its magic to clean and beautify your code.
  3. Save or Share: Once your code is formatted, you can download the result, share it via a unique link, or save it to your account by signing in with Google or GitHub.

That’s it! In just a few clicks, your code will be beautifully organized and ready to go.

Examples

Unbeautified:

      
#include <stdio.h>

int main()
{
int n, count, sum = 0;

printf("Enter the value of n(positive integer): ");
scanf("%d",&n);

for(count=1; count <= n; count++){sum = sum + count;}

printf("Sum of first %d natural numbers is: %d",n, sum);

return 0;
}
      
    

After beautified:

      
#include <stdio.h>

int main() {
  int n, count, sum = 0;

  printf("Enter the value of n(positive integer): ");
  scanf("%d", &n);

  for (count = 1; count <= n; count++) {
    sum = sum + count;
  }

  printf("Sum of first %d natural numbers is: %d", n, sum);

  return 0;
}
    
    

Supported languages

# Language Beautifiers Supported Upload Files
1 C ClangFormat **/*.c **/*.cats **/*.cl **/*.h **/*.idc
2 C# Pretty Diff **/*.cs **/*.cake **/*.cshtml **/*.csx
3 C++ ClangFormat **/*.cpp **/*.c **/*.c++ **/*.cc **/*.cp **/*.cxx **/*.h **/*.h++ **/*.hh **/*.hpp **/*.hxx **/*.inc **/*.inl **/*.ino **/*.ipp **/*.re **/*.tcc **/*.tpp
4 CSS Pretty Diff **/*.css
5 ColdFusion Pretty Diff **/*.cfc **/*.cfm **/*.cfml
6 Go Gofmt **/*.go
7 GraphQL Prettier **/*.gql **/*.graphql
8 HTML Pretty Diff **/*.htm **/*.html **/*.xhtml
9 HTML+ERB Pretty Diff **/*.html.erb **/*.html.erb **/*.erb
10 JSX Pretty Diff **/*.js **/*.jsx
11 Java Pretty Diff **/*.java
12 JavaScript Pretty Diff **/*.js **/*.es **/*.es6 **/*.frag **/*.gs **/*.jake **/*.jsb **/*.jscad **/*.jsfl **/*.jsm **/*.jss **/*.mjs **/*.njs **/*.pac **/*.sjs **/*.ssjs **/*.xsjs **/*.xsjslib
13 Less Pretty Diff **/*.less
14 Objective-C ClangFormat **/*.h **/*.m **/*.mm
15 PHP PHP-CS-Fixer **/*.php **/*.php_cs **/*.php_cs.dist **/*.aw **/*.ctp **/*.fcgi **/*.inc **/*.module **/*.php3 **/*.php4 **/*.php5 **/*.phps **/*.phpt
16 Python Black **/*.py **/*.gclient **/*.bzl **/*.cgi **/*.fcgi **/*.gyp **/*.gypi **/*.lmi **/*.py3 **/*.pyde **/*.pyi **/*.pyp **/*.pyt **/*.pyw **/*.rpy **/*.spec **/*.tac **/*.wsgi **/*.xpy
17 Ruby RuboCop **/*.rb
18 SCSS Pretty Diff **/*.scss
19 SQL sqlformat **/*.sql **/*.cql **/*.ddl **/*.inc **/*.mysql **/*.prc **/*.tab **/*.udf **/*.viw
20 SVG Pretty Diff **/*.svg
21 TypeScript Pretty Diff **/*.ts **/*.tsx
22 XML Pretty Diff **/*.xml **/*.xhtml