不喜欢广告? 无广告 今天

Solidity Code Formatter

开发人员
广告 移除?

Style Options

Used when normalising or inserting a missing pragma.
Long argument lists are wrapped to fit within this width.
广告 移除?

指导

Solidity Code Formatter

Solidity Code Formatter

Paste your Solidity smart contract source and get back clean, style-guide-compliant code in the browser — no installs, no Hardhat config, no remote compilation. The formatter reorders function modifiers, sorts pragmas and imports, normalises NatSpec comments, and applies consistent indentation so the output is ready for review or audit hand-off.

如何使用

  1. Paste your Solidity (.sol) source into the input box, or click 尝试一个示例 for a starter contract.
  2. Pick an indentation width (4 spaces by default, matching the official style guide), brace placement, and column limit.
  3. Decide whether to reorder function modifiers, sort pragma and import lines, and normalise NatSpec comments. All three are on by default.
  4. If you want the formatter to enforce a specific compiler version, switch the Solidity Version dropdown away from Keep existing pragma.
  5. The formatted code appears on the right with syntax highlighting; use the copy or download buttons to take it back into your project.

特征

  • Style-guide indentation — 4 spaces, 2 spaces, or tabs.
  • K&R or Allman brace placement — opening brace on the same line (default) or the next line.
  • Modifier ordering — visibility (public, external, internal, private) → mutability (pure, view, payable) → virtualoverride, with custom modifiers preserved after the standard ones.
  • Pragma and import sorting — pragmas first, then imports ordered alphabetically by quoted path.
  • Solidity version selector — keep the existing pragma or normalise to a recent 0.8.x release.
  • NatSpec normalisation////** */ blocks get a single space after the slashes and consistent * alignment.
  • Long-line wrapping — long argument lists are wrapped at the column limit you specify (40–200, default 120).
  • 完全在浏览器中运行 — your contract source never leaves your machine.

常问问题

想要享受无广告的体验吗? 立即无广告

安装我们的扩展

将 IO 工具添加到您最喜欢的浏览器,以便即时访问和更快地搜索

添加 Chrome 扩展程序 添加 边缘延伸 添加 Firefox 扩展 添加 Opera 扩展

记分板已到达!

记分板 是一种有趣的跟踪您游戏的方式,所有数据都存储在您的浏览器中。更多功能即将推出!

广告 移除?
广告 移除?
广告 移除?

新闻角 包含技术亮点

参与其中

帮助我们继续提供有价值的免费工具

给我买杯咖啡
广告 移除?