For small and learning-based DApps projects, it is suggested to work on the browser-based compiler by the Ethereum foundation: Remix. Another way is to install the Solidity compiler on to your machine. solc can be installed from npm using the following command:
npm install -g solc
Solidity can also be built from the source by cloning the Git repository present on the GitHub link: https://github.com/ethereum/solidity.git.