Sanity testing is usually performed when any minor bug is fixed or when there is a small change in the functionality. It is a kind of software testing which is done by the testers to ensure that the functionality is working as expected.
Sanity testing is narrow and deep. Unlike Smoke testing, Sanity testing is focused on one or two functionalities whereas smoke testing is done to ensure that all the major features of the project is working fine.
After the changes or fixes are done in the code the software build is available to the testers. Post installation of the build the testers will do the Sanity testing of the changed functionality instead of doing the entire regression testing which will take more time.