VBScript Code Formatter

Paste VBScript and press Format VBScript: indentation and spacing are rebuilt, colon-separated statements move to their own lines and keywords, built-in functions and constants get the standard VBScript casing. The highlighted result can be copied without running the script.

Runs locally in your browser
Copy

How to format VBScript

Paste a VBScript file or snippet and press Format VBScript: the tool rebuilds indentation and spacing, moves colon-separated statements onto their own lines and writes keywords, built-in functions and VBScript constants in their standard casing. The highlighted result appears below the buttons.

The script is only read, never executed, and the conversion sends nothing to the server. Strings, comments, date literals such as #1/1/2020 10:30:00 AM#, hex literals such as &HFF and labels such as Start: come through unchanged.

  1. Paste the code into the field at the top, or keep the sample that is loaded with the page.
  2. Press Format VBScript. The result replaces the previous output and is highlighted as VBScript.
  3. Use Copy for the clipboard and Clear to empty both the input and the result before the next script.
  4. With an empty field the page shows a message such as “Enter VBScript code to format.” in your language instead of formatting.

What changes and what does not

Rewritten by the formatter

Indentation is rebuilt from the block keywords the formatter recognises — Sub, Function, Property, Class, If/ElseIf/Else, For, Do, While, Select Case and With — and each level is written with four spaces. Spacing around the operators =, <, >, +, -, *, /, ^ and & is normalised, commas get a space after them and tabs inside the code become four spaces. A colon that separates two statements becomes a line break, and the body of “Case 1: y = 2” is indented under its Case.

Keyword case follows the VBScript spelling: if becomes If, endif becomes End If, goto becomes GoTo, and built-in names such as Chr, MsgBox, vbCrLf and WScript are written the same way. A single-line If ... Then ... statement stays on one line.

Left as written

Strings keep their contents, including doubled quotes and colons — “10:30” stays 10:30. Apostrophe comments and Rem comments stay on their line, so a colon inside a comment no longer splits it. Date literals between # marks, hex literals such as &HFF and exponent numbers such as 1.5E-3 are not spacing targets. A label such as Start: keeps its colon.

The formatter does not run the script, does not check that blocks are balanced and does not repair syntax: an End If without an If is printed as written. It does not minify, obfuscate or rename anything.

Where the work happens

The conversion runs in the browser with page JavaScript. Pressing the button makes no network request, so the formatter keeps working after the page has loaded even without a connection.

The output is plain text for any editor, with four spaces per indent level. Large scripts are handled in one pass: 150 KB formats in about 0.1 s in a desktop browser, 500 KB in about 0.3 s.

Recent tools: