Pretty basic but essential, extracted from the Solidity documentation:
Compared to regular state variables, the gas costs of constant and immutable variables are much lower. For a constant variable, the expression assigned to it is copied to all the places where it is accessed and also re-evaluated each time. This allows for local optimizations. Immutable variables are evaluated once at construction time and their value is copied to all the places in the code where they are accessed. For these values, 32 bytes are reserved, even if they would fit in fewer bytes. Due to this, constant values can sometimes be cheaper than immutable values.
There are also good resources available (I think it is a good idea to have this thread here on OpenZeppelin which is currently the main SC reference, which gathers all the tricks) such as blog posts or even better, research papers investigating this topic. A good and well structured one from Cagliari University is available at: