Gas Usage Optimizer Hints

Paste a contract, get well-known gas-saving patterns flagged — pattern matching, not a compiler.

Hints

Paste a contract to see gas hints.

A quick first pass, not a real analyzer

Real gas analysis needs a compiler and an understanding of your contract’s actual control flow and storage layout — tools like Slither do that properly. This is a much simpler first pass: recognizing a handful of well-known, high-confidence Solidity patterns directly in the text, entirely in your browser.

How it works

Every check here is chosen specifically because it’s a well-established, broadly-applicable pattern with a low false-positive rate — not an exhaustive list, just the patterns simple enough to recognize reliably without actually compiling the code.

Frequently asked questions

No — it's plain pattern-matching over the text you paste, with no compiler, no AST, and no understanding of control flow or types beyond simple regexes. Slither, Mythril, and similar tools actually parse and analyze the code; this just recognizes well-known textual patterns. Useful as a quick first pass, not a substitute for real tooling.

require() calls with a string message (custom errors are cheaper), leftover SafeMath usage on Solidity 0.8+ (redundant), small uint types as loop counters (the EVM works in 256-bit words natively), i++ vs ++i in loop increments, .length read directly in a loop condition, and storage variables that look like immutable candidates (assigned once, in the constructor, never reassigned).

Both, regularly. It has no idea whether a flagged array is storage or memory, whether a "constructor-only" variable is actually reassigned via some pattern the regex didn't anticipate, or about entire categories of gas issues (storage packing, redundant external calls, and more) it doesn't check at all. Treat every hint as something to verify yourself, not a fact.