Web3 Development

Prettier Plugin SolidityAutomatic Formatting for Solidity Code

Free, MIT-licensed Prettier plugin that formats Solidity smart contracts. Setup steps, safety notes and answers to common questions.

Free Open source Windows: Likely v2.4.1 Updated 29 Oct 2026
8 min read Last update 29 Oct 2026 github.com/prettier-solidity/prettier-plugin-solidity

Prettier Plugin Solidity is a free, open-source formatter extension for developers who write Solidity smart contracts and want their code to look the same across files and teammates. It works as a plugin for Prettier, the widely used code formatter, so one command rewrites your .sol files into a consistent layout. The project is released under the MIT license, and the latest release is v2.4.1.

The catalog lists the platform as macOS, while the project notes that it builds for Windows. That makes this page most useful for Windows developers who are willing to confirm compatibility on the releases page before committing to a workflow. Below you will find installation steps, a practical guide to formatting, honest pros and cons, and notes on how it compares with editors, compilers and testing tools.

02

What Is a Solidity Formatter and Why Does It Matter?

A formatter reads source code and rewrites its whitespace, line breaks, indentation and bracket placement according to a fixed set of rules. It does not change what the program does. For Solidity, that matters because smart contracts are often reviewed line by line, sometimes by people who did not write them, and a noisy diff can hide a real change.

Consistent formatting also makes audits and code reviews faster. When every function, modifier and event declaration follows the same layout, reviewers can focus on access control and state changes rather than on indentation debates. Teams that adopt a formatter early usually avoid the slow drift toward mixed styles that appears as several contributors touch the same repository.

Formatting is also a good habit to lock in before a project grows. Changing style rules later means reformatting old files, which creates large diffs. Setting the rules at the start keeps history readable.

03

Who Prettier Plugin Solidity Is For

This plugin suits developers who already use Prettier in JavaScript or TypeScript projects and want Solidity files handled the same way. If your repository holds a frontend, deployment scripts and contracts together, one configuration file can cover all of them.

Smart contract teams with several contributors benefit most, because formatting is decided once and enforced automatically. Solo developers who write small contracts can use it to keep personal projects tidy and to reduce churn when they return to older code.

Learners and instructors also find it useful. Well-formatted Solidity makes control flow and inheritance easier to follow. Teams running workshops can share one configuration so every example looks identical.

It is less suited to developers who want a full editing environment with compiling and debugging in one window, because this plugin does a single job.

04

How Prettier Plugins Handle Solidity Files

Prettier works by parsing a file into a syntax tree and printing that tree back out using a consistent set of rules. Plugins extend this process by teaching Prettier how to parse and print a language it does not handle natively. Solidity is that kind of language, so the plugin supplies the grammar-aware logic.

In practice, the formatter understands the structure of a contract, including pragma statements, imports, contract declarations, state variables, functions and events. It can place each element consistently even when the original file was written with mixed spacing or uneven line breaks.

Because the output depends on configuration, the same file can look slightly different in two projects with different settings. Keeping the configuration file in version control ensures everyone on the team gets the same result.

Plugins are installed alongside Prettier, so they run wherever Prettier runs. That is why Node.js is the practical prerequisite on any operating system.

05

Key features

Automatic Solidity formatting

Run Prettier over your Solidity files and the plugin rewrites them into a consistent layout. Indentation, line breaks and bracket placement follow one rule set, so code reviews can focus on logic instead of style. Everyone on the team gets the same output without manual cleanup.

Shared configuration with Prettier

Because the plugin runs through Prettier, you control its output with the same configuration file and documented options you use for other languages in the project. Settings such as line width apply consistently, so a repository that mixes frontend code and contracts can be governed by one setup.
06

How to install Prettier Plugin Solidity on Windows

  1. 1

    Check your Node.js setup

    Because the plugin is distributed as an npm package and runs alongside Prettier, you need Node.js with npm installed. Open a terminal such as PowerShell or Windows Terminal and run node --version and npm --version to confirm both are available. Update them if the versions are old.

  2. 2

    Download or install the package

    Download only from the official website or the project's GitHub Releases page at github.com/prettier-solidity/prettier-plugin-solidity. Most developers add the plugin to a project with npm instead of downloading a standalone file, which records the version in package.json and keeps it reproducible.

  3. 3

    Verify what you installed

    If a release publishes a SHA-256 checksum or signature, compare it with your downloaded file before use. Confirm that the version matches the release you intend to use, such as v2.4.1 or a newer tag you have reviewed.

  4. Connect the plugin to Prettier

    Add the plugin to your Prettier configuration so Solidity files are processed, then run Prettier on one sample .sol file to check the output. Adjust options only after you see how the default layout looks in your project.

07

System requirements

  • Node.js and npm, needed because the plugin is an npm package that runs alongside Prettier
  • Prettier installed in the project, since the plugin extends it rather than replacing it
08

How to use Prettier Plugin Solidity

Once the package is installed, formatting becomes a short routine. Most of the work happens in your project configuration rather than on the command line.

  1. Open your project folder in a terminal and confirm the package appears in your dependencies.
  2. Create or update your Prettier configuration file so Prettier loads the plugin for Solidity files.
  3. Set the options you want, such as line width and indentation, in the same file.
  4. Run Prettier on a single contract first and read the output carefully.
  5. Compare the result with the original file in version control before changing many files.
  6. Format the whole project once and commit the changes separately, so reviewers can skip that commit when reading history.
  7. Add a format check to your continuous integration pipeline so new code meets the same standard.
09

Pros & cons

Pros
  • Free and released under the MIT license
  • Open source, with the code available for inspection on GitHub
  • Built on Prettier, whose configuration and options are documented online
  • Gives Solidity files the same discipline as the rest of a Prettier-based project
  • Small scope makes it easy to understand what it changes
Cons
  • The platform listing names macOS, so Windows use needs confirmation on the releases page
  • Requires a Node.js toolchain, which may feel heavy for developers who only use compiler tools
  • Formatting is only as good as the configuration you set, and defaults may not match your team's style
  • Does not add editing, compiling or debugging features
10

Is Prettier Plugin Solidity safe?

Prettier Plugin Solidity is a formatting tool, not a wallet or a signing tool, so it does not handle keys or seed phrases. It still runs code inside your project, so treat the package like any other development dependency. Download only from the official website or the project's GitHub Releases page, and install through npm using the package name that matches the repository. Where a release publishes a SHA-256 checksum or signature, compare it with your downloaded file before use. Never enter a seed phrase on a third-party website, and avoid copies of the package from unfamiliar sources.

  • Official source only. Download from github.com/prettier-solidity/prettier-plugin-solidity. Ignore ads and lookalike domains.
  • Check the SHA-256. Compare the installer hash with the value the developer publishes before running it.
  • Never share your seed phrase. No developer, support agent or website — including CryptApps — will ever ask for it.
11

Alternatives

Prettier Plugin Solidity sits in a different place from the other tools in this catalog. Remix Desktop is a full IDE for writing Solidity, and Visual Studio Code with a Solidity extension is a general editor that can grow into a smart contract environment. Both are broader than a formatter. The Solidity compiler, solc, turns source code into bytecode and is essential for building contracts, but it does not manage style. Foundry is a command-line toolkit for smart contract development, and Tenderly CLI focuses on debugging and monitoring. This plugin is the narrowest of the group. Install it when you want a consistent layout, then pair it with whichever tools handle the rest of your workflow.

12

Specifications

Price
Free
Type
Open source
License
MIT
Latest version
v2.4.1
Last update
29 Oct 2026
Windows support
Likely (builds for Windows; check releases)
Source code
github.com/prettier-solidity/prettier-plugin-solidity
13

Frequently asked questions

Yes. Prettier Plugin Solidity is free and released under the MIT license, which allows use in personal and commercial projects. The source code is hosted on GitHub, so you can read it before installing. The license covers the software itself, not any paid support you might arrange separately.

It may, but confirm before adopting it. The platform listing names macOS, while the project notes that it builds for Windows. Open the releases page on GitHub, read the latest release notes, and test the plugin on a sample contract before rolling it out across a team.

The main risk is installing a copy from an unofficial source rather than the plugin itself. Use the GitHub repository as your reference point, verify any published checksum, and install through npm. Treat the package as you would any dependency your project relies on.

Install the package in your project with npm, add it to your Prettier configuration, and run Prettier on a single .sol file to check the result. Once the output looks right, apply it to the rest of the project. The how to use section lists each step in order.

Formatting should change layout only, not logic, because the plugin rewrites whitespace and line structure. Still, run your test suite after reformatting a large set of files and review the diff before merging. Keep formatting changes in separate commits so functional changes stay easy to review.

Yes. The plugin is distributed as an npm package and runs alongside Prettier, so Node.js and npm must be installed. Check both with version commands in a terminal before you start, and keep them updated on a schedule your team agrees on.

A formatter rewrites code to a set style without judging correctness, while a linter reports patterns that may be risky or wrong. This plugin is a formatter. Many teams run it alongside a linter so that style and quality checks are handled as separate steps.

Broader tools such as Remix Desktop and Visual Studio Code with a Solidity extension cover editing and may include their own formatting options. Check each tool's documentation before switching. A formatter-only tool suits teams that already have an editor they like and only need consistent layout.

14

Verdict

Prettier Plugin Solidity is a sensible choice for teams that already use Prettier and want Solidity files to follow the same discipline. It is free, MIT-licensed and narrow in scope, which keeps its purpose clear. The main caveats are confirming Windows support on the releases page and setting up Node.js. If you want a complete development environment, use it alongside a broader tool rather than as a replacement. Check the latest version on the official website before you install.

Download now