Javascript Formatter Online

Overview

This beautifier will reformat and re-indent bookmarklets, ugly JavaScript, unpack scripts packed, as well as partly deobfuscate scripts processed. It is used to improve the readability of JavaScript code.

Options

  • Indentation size
  • Wrap lines that exceed N characters
  • Maximum number of line-breaks to be preserved in one chunk [10]

Features

  • Format code in single click
  • Copy & Clear entire formatted JS code in single click
  • Works without internet (Need first time internet)
  • All formatting are made in the browser, it does not consume device resources
  • Works on maximum browser (Chrome recommended)

How to use?

  1. Enter JS code in the editor.
  2. Click "Format JS" button and it will format the JS code and show in output.
  3. Click "Copy" button. Success! Copied successfully. Please paste anywhere.
Input:

function getSize(width, height) {
    iframe_field = document.getElementById('iframe-field');
 let iframe = '<iframe width="' + width + '" height="' + height + '" src="https://google.com"></iframe>';
iframe_field.value = iframe;let sizes = document.getElementsByClassName('sizes');
    for (i = 0; i < sizes.length; i++) {
        sizes[i].style.backgroundColor = 'white';
    }document.getElementById(event.target.id).style.backgroundColor = 'red';
}
var i = 0;
document.getElementById('source').addEventListener('click', function() {
if (i == 0) {document.getElementById('s-container').style.display = 'block';i = 1;
} else {document.getElementById('s-container').style.display = 'none';i = 0;}
});

Output:

function getSize(width, height) {
    iframe_field = document.getElementById('iframe-field');
    let iframe = '<iframe width="' + width + '" height="' + height + '" src="https://google.com"></iframe>';
    iframe_field.value = iframe;
    let sizes = document.getElementsByClassName('sizes');
    for (i = 0; i < sizes.length; i++) {
        sizes[i].style.backgroundColor = 'white';
    }
    document.getElementById(event.target.id).style.backgroundColor = 'red';
}
var i = 0;
document.getElementById('source').addEventListener('click', function() {
    if (i == 0) {
        document.getElementById('s-container').style.display = 'block';
        i = 1;
    } else {
        document.getElementById('s-container').style.display = 'none';
        i = 0;
    }
});

Why to use Javascript Formatter?

The large project consists of the bulk of JS coding. And sometimes, programmers forget the formatting of the code and focus on just logic building. This Javascript Formatter will help you not to worry about the indentation and formatting of your code, save your time; that is how you can focus more and more on logic and functionality.