There are not clear-cut definitions to distinguish them but there are strong patterns.
Classical functions of a window manager (WM)
- Position and sizes of the windows, as well as repositioning and resizing them.
- Layers — some windows are on top, some are below, some are docks, ...
- Positioning via stacking or tiling algorithms.
- Virtual desktops (a.k.a. workspaces).
- Closing, maximizing, minimizing (a.k.a. iconifying), raising, lowering, etc. windows.
- Focus — determine window receives keyboard.
- Decoration — title-bars and title-buttons (optional, e.g. absent from Dwm and Spectrwm).
Classical functions of a desktop environment (DE)
Some will mention
menus (such as Windows' start menu), task-bars and window lists, but, for example, despite Icewm features those, it is a WM, not a DE.
That's because a fundamental point of DEs is that they ship their own set of general purpose GUI applications, such as file managers, image viewers, calendars, and so on.
Additionally, quintessential to DEs is a set of GUI utilities for configuration, not only of the DE itself but also of system parameters that could otherwise be controlled via command-line (CLI). Examples:
Evidence and references
You don't need to believe me, just look at some packages dependencies in Ubuntu repositories:
muon (software center),
juk (music player),
gwenview (image viewer),
shotwell (image viewer),
gnome-screenshot, and a bunch of others via
nautilus (file manager),
gnome-software (software center),
baobab (disk usage),
and contrast them with window-managers — I3, Xmonad, Icewm, Bspwm —, whose dependencies are system libraries, not GUI programs at all besides the old, classical
DEs are heavier than WMs.
In a sense, DEs act as a valuable bridge for those migrating from Windows/Mac, who are generally heavily GUI reliant, to the GNU/Linux world, that is historically more CLI oriented.
That's why some advanced users call DEs bloated. From their point of view, it includes a lot of graphical interface for tasks that are simple to achieve via a command-line. And how come DEs feature a whole bunch of default programs? Such users want to build their own tool-set and can easily do so; They only need a WM to perform the basic and indispensable window operations.
Don't let snobs drive you away, though. Use whatever you are most comfortable with and gets the job done. If you are curious and want to find out what's happening under the hood and how to deal with the CLI, you'll probably find to be slowly steering away from DEs.