For a device to reach another device on the internet, you need to know its IP address.

But an IP address isn't enough.
We say that an IP address is like a home address.
Sending mail to a home address doesn't guarantee that it's received by the person.
The person might have moved.
We need something that can uniquely identify the person (device).
That thing is called the MAC address.
Unlike an IP address, it is unique to the device and almost never changes.
Think of it as an ID card.
The manufacturer creates it and burns it into the device.

How it works
With both IP and MAC address, you can make sure that your data reaches the right device.
Let's say you want to send data from device A to device B.
A would need B's IP address and MAC address.
How do you get the MAC address?
You send a broadcast (ARP broadcast from A) to every device on the network to ask B to say its MAC address.

B replies with its MAC address. And finally, A can send the data.

Different network
BUT, MAC only works for devices within the same network.
If you need to send data to a different network, the process is trickier.
Let's say you want to send data from A to animecoders dot com.
So first, A gets the IP address of animecoders dot com's web server.
But you can't get the MAC address of a device outside your local network.
So what do you do?
You use the router.

A sees that this IP is not on its own network.
So it sends the data to the router (default gateway) instead.
The router reads the destination IP address and picks the best route to go there.
It finds router 2.
It gets the IP and MAC address of router 2 and sends the data to it.
After a couple of more routers, the data finally reaches animecoders dot com's web server.
- Fee from Anime Coders
PS: If you have any technology, concepts, or terms that you want me to cover, hit reply.
