# ERC20 - Difference between transfer and transferFrom

By [N00b21337](https://paragraph.com/@n00b21337) · 2024-03-11

---

This is more a note to myself as to when is transfer used and when is transferFrom and that with transferFrom you need to have approval of token transfers and for just pure transfer its not needed.

1.  `transfer` **function**: This function allows a token holder to directly transfer their tokens to another address. It does **not require any prior approval** because the token holder is initiating the transfer of their own tokens. The syntax is generally like `transfer(recipient, amount)`, where the sender is the one who is currently connected and authenticated.
    
2.  `transferFrom` **function**: This function allows an address to transfer tokens on behalf of another address. Before `transferFrom` can be executed, **the token owner must explicitly allow a third party (the spender) to transfer a specified** amount of tokens from their balance. This is done using the `approve` function. The `approve` function sets an allowance, which is the maximum the spender can transfer on behalf of the owner. After approval, `transferFrom` can be used by the spender to transfer the specified amount of tokens up to the allowance. The syntax is like `transferFrom(sender, recipient, amount)`

---

*Originally published on [N00b21337](https://paragraph.com/@n00b21337/erc20-difference-between-transfer-and-transferfrom)*
