Skip to main content

Julia Code Formatter

Format and beautify Julia (.jl) source — re-indent by end-delimited blocks (function, if, for, struct, module), normalize spacing around operators and after commas, and optionally strip comments and collapse blank lines. Runs entirely in your browser.

Input

Formatting Options

Output

Formatted Code
 
Was this helpful?

Guides

The Julia Code Formatter cleans up messy or hand-written Julia (.jl) source in one click. Paste your code and it re-indents every block, tidies the spacing around operators and after commas, and gives you back readable, consistently formatted Julia — no installs, no command line, nothing to configure.

Julia's block structure is defined by keyword pairs that close with end: function ... end, if ... elseif ... else ... end, for ... end, while ... end, begin ... end, let ... end, module ... end, struct ... end, try ... catch ... finally ... end, macro ... end, quote ... end, and do ... end. This formatter tracks those openers and closers (plus nested brackets) to compute the correct indentation depth for each line, so a snippet you pasted with no indentation comes back properly nested.

How to use it

  1. Paste your Julia code into the input box, or click Try an example to load a sample module.
  2. Pick your options: indent style (4 spaces, 2 spaces, or tabs), whether to put spaces around binary operators, whether to keep comments, and whether to collapse runs of blank lines.
  3. The formatted result appears instantly on the right. Use Copy or Download to grab it as formatted.jl.

Formatting runs as you type, so you can tweak an option and see the effect immediately.

What does it change?

It normalizes indentation based on block keywords, adds spaces around assignment and comparison operators (=, ==, <=, &&, and friends), tightens type annotations (x::Int, T<:Real), puts a space after commas in argument and tuple lists, and — optionally — removes comments or squeezes multiple blank lines into one. String literals, character literals, and comments are detected and left untouched, so a brace, keyword, or end that appears inside "a string" never affects the layout.

Does it understand string interpolation and comments?

Yes. Regular strings, triple-quoted strings ("""..."""), prefixed strings (r"...", raw"..."), and interpolations like "$x" and "$(expr)" are kept intact. Line comments (# ...) and nestable block comments (#= ... =#) are recognized and preserved by default.

Is this the same as JuliaFormatter.jl?

No. This is a lightweight, in-browser beautifier focused on indentation and spacing. It does not run Julia, parse a full grammar, wrap long lines, or reflow expressions the way the official JuliaFormatter.jl package does. For quick tidying of a snippet it is instant and requires no Julia installation; for authoritative, project-wide formatting, use JuliaFormatter.jl in your toolchain.

Is my code private?

Completely. All formatting happens entirely in your browser — your code is never uploaded, stored, or sent to any server. You can even use the tool offline once the page has loaded.

juliajlcode formatterbeautifyprettifyindent

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.