I can never remember what the conversion is from something like rw-r--r-- to 644. Is there a simple web based converter between the 2?

  • It's just an octal number with the binary digits being mapped to rwxrwxrwx (user, group, other).
    – Keith
    Commented Mar 18, 2011 at 6:04
  • this can easilly be calculated by hand. or they can be displayed by stat -c ...
    – fromnaboo
    Commented Apr 7, 2013 at 16:54
  • Does your chmod not support the symbolic mode. I have been told that most do. The Gnu one defiantly dose. e.g. turn on group write chmod g+w, set the mode rw-r--r-- chmod =r,u+w or chmod u=rw,go=r. Commented Jul 16, 2020 at 22:22

7 Answers 7


This site provides an interactive way to see what permissions bits are set when various bits are set/unset.

The "calculator" looks like this:


  • 6
    The link is broken now, which is why we generally discourage link-only answers, but it's hard to criticize when the question asked for a link Commented Nov 4, 2012 at 19:45

Why do you need an octal number in the first place?

I always use:

chmod o+x file   # all + eXecute permissions
chmod g-w file   # group - write perms
chmod u=r file   # user can just read
chmod ug=rw file # user,group = read and write
chmod a+w file   # user,group,others + write 

ugo(a) is easy to remember. However, you can confuse o:=owner? o:=other? But what would be u, if o=owner? u:=user, therefore o=other.

Some commands like numerical permissions only. Okay, it's not hard to calculate, if you remember the two sequences: ugo + rwx.

    r   w   x  | Sum
u   4   2   1  | 7
g   4   -   1  |  5
o   4   2   -  |   6

Yes, very artificial.

When it comes to s and S I have to consult the manual. Maybe google next time. :)

  • Other programs that can have permissions don't always provide support for the semantic strings since the underlying interface is octal and easier to support. The first part of this answer is condescending and unnecessary. Just answer the question...
    – salotz
    Commented May 26, 2020 at 19:40
  • 2
    If you read my answer as condescending you're misinterpreting the tone. Commented May 26, 2020 at 20:10
  • > Why do you need an octal number in the first place?
    – salotz
    Commented May 27, 2020 at 14:57
  • > "Some commands like numerical permissions only." I may add: Some documentation only lists numerical values. Commented May 28, 2020 at 0:26

Octal is used for permissions because it's an easy conversion. Each group of rwx forms one octal digit. All you have to remember is the first 3 powers of 2: 4, 2, 1. r = 4, w = 2, x = 1.

rw-r--r-- = 110 100 100 = 4+2+0 4+0+0 4+0+0 = 644


I like this permissions calculator:

  • Normally, I would flag this for being a link-only answer, but since the OP was explicitly asking for a website, I will let it pass. Be aware though that link-only answers are often discouraged.
    – HalosGhost
    Commented Oct 17, 2014 at 20:11
  • This site doesn't seem to work right now. I see "403" errors in the console.
    – Ryan
    Commented Sep 14, 2019 at 22:39
  • +1 for a calculator that calculates permissions to/from the "ls" format (i.e. -rwx--S---)
    – kbulgrien
    Commented Jul 16, 2020 at 17:32
  • This is the only answer that directly answers the question
    – yeah22
    Commented Nov 7, 2020 at 0:12

I have this little alias that you can put in your .bashrc (or equivalent).

DISCLAIMER: I am not the author of the script, and I'm not sure who wrote it... but props to him/her for doing this.

alias lsp="ls -l --color | 
      awk '{k=0; for(i=0;i<=8;i++) k+=((substr(\$1,i+2,1)~/[rwx]/)*2^(8-i));
      if (k) printf(\" %0o \",k); print}'"
  • 1
    Many thanks for that, @nico - here is the same code converted as a perl one-liner, and used in bash: echo 'rwxrwxrw-' | perl -ne 'BEGIN{sub conv{ chomp(my $ins=shift); my $k=0; for(my $i=0;$i<=8;$i++) { my $tmps = ( substr($ins, $i, 1) =~ /[rwx]/ ); $k+= ( $tmps*(2**(8-$i)) ); }; if ($k) { sprintf(" %0o ", $k); } else { "??" ; }; }; } print(conv($_)."\n");' would print "776". Cheers!
    – sdaau
    Commented Jul 16, 2014 at 6:04
  • Sadly the scripts above are incomplete and do not handle setuid/setgid/sticky permissions.
    – kbulgrien
    Commented Jul 16, 2020 at 17:35

This is by far the most convenient, and is besides I believe, exactly what you asked for originally:


It is fully interactive, though you cannot edit the string "-r-x-------" but you can the octal or the checkboxes. Doing either updates the other.

My favourite tool for just this

From the same page:

Numeric (absolute) mode:

From one to four octal digits Any omitted digits are assumed to be leading zeros.

The first digit = selects attributes for the set user ID (4) and set group ID (2) and save text image (1) The second digit = permissions for the user who owns the file: read (4), write (2), and execute (1) The third digit = permissions for other users in the file's group: read (4), write (2), and execute (1) The fourth digit = permissions for other users NOT in the file's group: read (4), write (2), and execute (1)

The octal (0-7) value is calculated by adding up the values for each digit User (rwx) = 4+2+1 = 7 Group(rx) = 4+1 = 5 World (rx) = 4+1 = 5 chmod mode = 0755

  • This "calculator" is broken with respect to 4-digit numbers even though the text talks about 4-digits. i.e. Entering 2777 should show "-rwxrwsrwx", but "--w-rwxrwx" is shown instead.
    – kbulgrien
    Commented Jul 16, 2020 at 17:26
  • there is a fith digit, the mac/dac level
    – Max Muster
    Commented Jun 3, 2023 at 13:50

Even though this is not a "web" calculator, since nico's answer does not handle setuid, setgid, and sticky indicators, but does get up-votes, an example of an updated scriptlet that handles the extra permissions states may be warranted:

ls -l | \
awk '{k=0; for(i=0; i<=8; i++) k+=((substr($1, i+2, 1) ~ /[rwxs]/)*2^(8-i));
     if ($1 ~ /^.{3}[Ss]/) k+=2048; if($1 ~ /^.{6}[Ss]/) k+=1024;
     if ($1 ~ /[Tt]/) k+=512; if(k) printf("%4o ",k); print; }'

This question is a better fit for scripted solutions where glenn jackman offers a perl stat one-liner similar to:

$ what="/tmp"
$ perl -s -e '@fields = stat "$f"; printf "%04o\n", $fields[2] & 07777' -- -f="$what"

The awk script is based on one found here

  • That's great, I will definitely update my .bashrc now! :)
    – nico
    Commented Jul 17, 2020 at 9:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .