A L2 switch does switching only. This means that it uses MAC addresses to switch the packets from a port to the destination port (and only the destination port). It therefore maintains a MAC address table so that it can remember which ports have which MAC address associated.
A L3 switch also does switching exactly like a L2 switch. The L3 means that it has an identity from the L3 layer. Practically this means that a L3 switch is capable of having IP addresses and doing routing. For intra-VLAN communication, it uses the MAC address table. For extra-VLAN communication, it uses the IP routing table.
This is simple but you could say "Hey but my Cisco 2960 is a L2 switch and it has a VLAN interface with an IP !". You are perfectly right but that VLAN interface cannot be used for IP routing since the switch does not maintain an IP routing table.
Simply put, a layer 3 switch can forward packets between different networks like a router while layer 2 switches forward packets to different segments/or within a given network.
A switch can be thought of as a more powerful bridge and a less powerful router.
If a switch is configured to work only as a bridge, it is called a layer 2 switch.
If a switch is configured to work only as a router, it is called a layer 3 switch.
More often, a switch is configured to perform both these functions(layer2 as well as layer3):
Either together on the same ports(using Integrated Routing and Bridging, ie, IRB): If the DMAC in the incoming IP data packet is of the IRB interface, routing or layer 3 behavior is done.
Otherwise, the packet is bridged(layer 2 behavior) on all the same vlan ports.
Or, on separate sets of ports of the switch(some ports as L2 ports while some ports as L3 ports): A set of "x" ports on a switch may be configured as a bridge(and will bridge packets). While, another set of "y" ports may have IP addresses assigned to them and will act as router ports(routing received IP packets).
Layer 2 is generally hardware i.e. mac address "routing" or mac tables. Layer 3 has to do with ip's. Layer 3 devices are usually managed and they can create and route between vlans.
I will complete Zoredache's answer.
A L2 switch does switching only. This means that it uses MAC addresses to switch the packets from a port to the destination port (and only the destination port). It therefore maintains a MAC address table so that it can remember which ports have which MAC address associated.
A L3 switch also does switching exactly like a L2 switch. The L3 means that it has an identity from the L3 layer. Practically this means that a L3 switch is capable of having IP addresses and doing routing. For intra-VLAN communication, it uses the MAC address table. For extra-VLAN communication, it uses the IP routing table.
This is simple but you could say "Hey but my Cisco 2960 is a L2 switch and it has a VLAN interface with an IP !". You are perfectly right but that VLAN interface cannot be used for IP routing since the switch does not maintain an IP routing table.
The layer 3 vs 2 refers to the OSI model. A layer 3 switch supports routing. A layer 2 switch only knows ethernet, you may be able to setup VLANs.
Simply put, a layer 3 switch can forward packets between different networks like a router while layer 2 switches forward packets to different segments/or within a given network.
A switch can be thought of as a more powerful bridge and a less powerful router.
If a switch is configured to work only as a bridge, it is called a layer 2 switch.
If a switch is configured to work only as a router, it is called a layer 3 switch.
More often, a switch is configured to perform both these functions(layer2 as well as layer3):
Either together on the same ports(using Integrated Routing and Bridging, ie, IRB): If the DMAC in the incoming IP data packet is of the IRB interface, routing or layer 3 behavior is done. Otherwise, the packet is bridged(layer 2 behavior) on all the same vlan ports.
Or, on separate sets of ports of the switch(some ports as L2 ports while some ports as L3 ports): A set of "x" ports on a switch may be configured as a bridge(and will bridge packets). While, another set of "y" ports may have IP addresses assigned to them and will act as router ports(routing received IP packets).
Layer 2 is generally hardware i.e. mac address "routing" or mac tables. Layer 3 has to do with ip's. Layer 3 devices are usually managed and they can create and route between vlans.