Every file and directory on a Linux or Unix system carries a permission mode that controls who may read, write and execute it. The mode is split across three classes of user — the owner, the group and others (everyone else) — and each class gets its own three bits: read (4), write (2) and execute (1).
Add those values within a class and you get one octal digit: read plus write plus execute is 7, read plus execute is 5, read plus write is 6. Three classes give the familiar three-digit modes you pass to chmod, such as 644 or 755. The same permissions can be written symbolically — the -rwxr-xr-x string that ls -l prints — where each letter is one bit and a dash is a bit that is off.
On a directory the bits mean something slightly different: read lists the entries, write creates or deletes them, and execute lets you enter the directory and reach what is inside. That is why a directory almost always needs its execute bit set even when a plain file would not.
Three special bits sit above the usual nine: setuid, setgid and the sticky bit. They add a fourth leading octal digit and change how a program runs or how a shared directory behaves. Toggle any of them in the calculator to see the effect spelled out for a file and for a directory.