What is the difference between Soft Fork and Hard Fork?

Soft Fork is a change to the software protocol where only previously valid blocks/transactions are made invalid. Since old nodes will recognize the new blocks as valid, a soft fork is backward compatible.

It is a fork where updated versions of the protocol are backwards compatible with previous versions.

In Soft Fork, blocks violating new rules are made state by the upgraded mining majority.

An example is a Soft Fork that restricts the block size limit from 1MB to 500KB. Even though a 1 MB block was previously considered valid, full nodes that upgrade to support the Soft Fork will reject any blocks larger than 500KB after the Soft Fork activates.

Hard Fork:
Hard Fork is a radical change to the protocol that makes previously invalid blocks/transactions valid (or vice versa) and as such requires all notes or users to upgrade to the latest version of the protocol software.

A Hard Fork is a change of the Bitcoin protocol that is not backwards compatible with older versions of the client.

In Hard Fork, non-upgraded notes reject the new rules, diverging the chain.

An example is a Hard Fork that increases the block size limit from 1MB to 2MB. Even though a 2 MB block was previously considered invalid, full notes that upgrade to support this Hard Fork will accept any blocks of up to 2MB in size after the Hard Fork has activates.