# Contract code size exceeds 24576 bytes and/or Stack too deep when compiling inline assembly

By [N00b21337](https://paragraph.com/@n00b21337) · 2023-01-11

---

If you getting keep getting both or either

\*\*"Contract code size exceeds 24576 bytes " **or \*\* "Stack too deep when compiling inline assembly: Variable \_3 is 8 slots"**  
(replace 3 and 8 with x and y in your case)

there is are some solutions that could help depending on the case, sometimes you will need to refactor your smart contracts and make them smaller in size or add state changes after deployment to make SC smaller.

You can use optimizer with settings like this (Hardhat and Truffle) and this should make the contract smaller in size, but could activate that other error unless **Yul** optimizer is disabled as there seems to be some bug with it.

        settings: {
          optimizer: {
            enabled: true,
            runs: 200,
            details: {
              yul: false
            }
          },
        },

---

*Originally published on [N00b21337](https://paragraph.com/@n00b21337/contract-code-size-exceeds-24576-bytes-and-or-stack-too-deep-when-compiling-inline-assembly)*
