Umask Calculator
Calculate the permissions created by a Unix umask. Enter a symbolic or octal umask such as 022 or u=rwx,g=rx,o=rx.
How umask changes a new file
The umask is a mask of bits to clear when a program creates a file or a directory. Programs ask for a base mode, commonly 666 for files and 777 for directories, and the kernel turns off whatever the umask has set. A umask of 022 clears write for group and other, so a new file is 644 and a new directory is 755. A umask of 077 clears all group and other bits, so a new file is 600 and a new directory is 700.
Enter 022. The file result should be 644 and the directory result 755. Enter 027 and group keeps read on a file (640) while other gets nothing. That is a common choice on a shared host where a project group should read files and the rest of the system should not. Enter 002 on a shared directory workflow only when you also use a setgid directory; otherwise new files are group-writable by whoever your primary group is.
The calculator does not read the umask of a server. It shows the arithmetic. Shells set umask for the processes they start. systemd units have their own UMask. A file that already exists is not changed by umask. chmod does that. The result is also not an ACL. If the directory has a default ACL, the created mode can differ from this table.
Use three or four octal digits. 22 and 022 are the same mask. A value with a digit above 7 is not octal.
