Beautify Code

Beautify/format code using conventions, support many popular languages

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

Introduction

This is an online tool which can help you to beautify, format and clean your code in many popular languages. Currently it supports 22 various languages including markup, front-end, back-end languages. You can see what languages the tool supports in the table on the right side.

This tool is powered by strong beautifiers, and they will be updated frequently. Each beautifier supports many options, styles to beautify your code in the way you want.

How to use this tool?

You can input/paste your code directly into the editor or upload your code file using the Upload button. You can find which file types the tool support to upload on the right.

After beautifying/formatting your code, you can download or save/share the result. It will create a link for you to share with others. You can also sign-in using Google/GitHub to save results into your account.

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