What is an UMASK and how to set it in Linux/Unix?

UMASK(User Mask or User file creation MASK) is the default permission or base permissions given when a new file(even folder too, as Linux treats everything as files) is created on a Linux machine. Most of the Linux distros give 022(0022) as default UMASK. In other words, It is a system default permissions for newly created files/folders in the machine. How to calculate UMASK in Linux? Though umask value is same for files and folders but calculation of File base permissions and Directory base permissions are different.