This bit has a symbolic representation of s (lower case ‘s’). Its numeric value is 2000 for setgid and 4000 for setuid.
When this bit is set on a regular file, then privilege level is set to the user/group owner’s regardless of who executes the file. This can be quite dangerous. For example, if the executable tar has this bit set, it means that everyone will run tar with root privileges (because tar is usually owned (user and group) by root).
It is strongly suggested that files should not have this bit set, unless there is a very good reason.
When the setgid bit is set on a directory, it forces all newly created files and subdirectories (after setting the setgid bit) to “inherit” the group ownership of the directory itself. With this bit cleared, all files and directories created have both the user and group ownership set to the user who creates the file.