Both of them are changes in protocol.
A 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.
A hard fork is a radical change to the protocol that makes previously invalid blocks/transactions valid, or vice-versa, and as such requires all nodes or users to upgrade to the latest version of the protocol software. A hard fork is a permanent divergence from the previous version of the Blockchain, and the newest version will no longer accept nodes running on previous versions.
Useful. Thanks