Julia Code Formatter
Guide
Julia Code Formatter
Paste any Julia (.jl) source and get instantly reformatted output following the conventions used by the wider Julia scientific-computing community. The tool runs entirely in your browser — no Julia runtime, no server round-trip — so even confidential research or proprietary code can be cleaned up safely.
The formatter mirrors the default style of JuliaFormatter.jl: four-space indentation, consistent spacing around binary operators, tight type annotations such as x::Int et T <: Real, preserved juxtaposition multiplication like 2π, and a configurable soft line-length warning at 92 characters.
Comment utiliser
- Paste your Julia code into the Julia Code textarea, or click Essayez un exemple to load a sample module.
- Sélectionnez un Style d'indentation — four spaces is the JuliaFormatter default, two spaces and tabs are also available.
- Ajustez la Longueur de ligne slider if your team uses a width other than 92 characters. Long lines are reported but never broken automatically, so the result stays syntactically equivalent.
- Basculer spacing around binary operators, tight type-annotation spacing, preserve commentset collapse multiple blank lines to taste.
- Cliquez Format. Copy the result with the clipboard button or download it as a
.jlfichier.
Caractéristiques
- JuliaFormatter default style – four-space indentation, blank-line conventions, and consistent operator spacing out of the box.
- Block-aware indentation – correctly handles
function,if/elseif/else,for,while,try/catch/finally,let,begin,do,module,struct,quote,macroetabstract type/primitive typedeclarations. - Unicode-aware tokenizer – recognises Greek-letter and other Unicode identifiers such as
π,α,θetΔ. - Juxtaposition multiplication preserved – numeric coefficients written as
2πou0.5xstay tight, while explicit2 * πstays spaced. - Tight type annotations –
x::Int,T <: RealetVector{<:Shape}remain compact. - Comments and strings respected – line comments (
#), nestable block comments (#=…=#), triple-quoted strings, prefixed strings (r"…",raw"…"), char literals, and string interpolation are left intact. - Soft line-length report – exceeding lines are counted so you can refactor manually without the formatter breaking semantics.
- Copie et téléchargement en un clic as
formatted.jl. - Traitement côté client à 100 % – nothing leaves your browser.
FAQ
-
What style guide does the JuliaFormatter default follow?
The JuliaFormatter.jl default style is the most widely adopted convention in the Julia community. It uses four-space indentation, surrounds most binary operators with single spaces, keeps type annotations and subtype operators tight (e.g.
x::Int,T<:Real), preserves juxtaposition multiplication such as2π, and targets a soft line width of about 92 characters. Several Julia-organisation packages bundle this style as the baseline for contributions. -
Why does Julia allow numbers and identifiers to be written together without an operator?
Julia treats a numeric literal immediately followed by an identifier or parenthesised expression as implicit multiplication — a feature called juxtaposition. So
2πmeans2 * π,0.5xmeans0.5 * xet3(a + b)means3 * (a + b). The numeric literal must come first; the reverse (π2) is not valid because Julia cannot tell whether it is a multiplication or part of an identifier name. Style-wise, the convention is to keep juxtaposition tight without an inserted space. -
How are Julia block structures different from C-style languages?
Julia uses keyword-delimited blocks instead of curly braces. Almost every block opener —
function,if,for,while,let,begin,try,do,module,struct,macro,quoteetabstract type/primitive type— is closed by a matchingendtoken. Continuers likeelseif,else,catchetfinallysit at the same indentation as the opener but introduce a new body at the next deeper level. This makes Julia code visually closer to Ruby or Lua than to Java or C. -
What is the difference between a regular string and a non-standard (prefixed) string literal in Julia?
In Julia a regular double-quoted string like
"hello"is processed by the standardStringconstructor with backslash escape sequences. A prefixed string such asr"\d+"ouraw"C:\path"calls a non-standard string macro —rfor regular expressions,rawfor unescaped content,bfor byte arrays, and many others including user-defined ones. Inside a non-standard literal the contents are passed verbatim, so backslashes are not consumed by the lexer. Triple-quoted variants ("""…""") span multiple lines and trim a common leading indentation.
Installez nos extensions
Ajoutez des outils IO à votre navigateur préféré pour un accès instantané et une recherche plus rapide
恵 Le Tableau de Bord Est Arrivé !
Tableau de Bord est une façon amusante de suivre vos jeux, toutes les données sont stockées dans votre navigateur. D'autres fonctionnalités arrivent bientôt !
Outils essentiels
Tout voir Nouveautés
Tout voirMise à jour: Notre dernier outil was added on Mai 30, 2026
