Transactions that are recorded on the blockchain itself and shared with all of the participants are done on-chain.
A blockchain system is essentially a network that contains a distributed ledger that can be considered as a shared database. The transactions that are recorded on the blockchain itself and shared with all of the participants are done on-chain.
Whenever a new transaction is conducted, a new block needs to be added to the blockchain, and there are consensus protocols that need to be followed in order for the transaction to be considered a valid one.
On-chain transactions are transactions that occur on a blockchain, which are reflected on the distribution as well as the public ledger. The on-chain transactions are those that have already been validated as well as authenticated by the miners or authenticators. These can in turn lead to an overall update to the blockchain network itself.
Furthermore, for an on-chain transaction to be complete, there has to be an agreed number of confirmations by the miners, where the time it takes for an on-chain transaction to complete also depends on the network congestion. Sometimes transactions are delayed if there is a large volume of transactions that need to be confirmed.
When we compare this to off-chain transactions, this is the second variation when it comes to transaction variation. They differ in a number of ways: off-chain transaction agreements happen actually outside of the blockchain, and this protocol employed with off-chain transactions is similar to that which is used on payment platforms, one of the most popular ones being PayPal.
This means that the parties which are involved in the transaction have the ability to pick an agreement outside of the blockchain, and the next step can potentially involve a third party whose role is to confirm the completion of the transaction as well as certify that the agreement has been obeyed by both parties.