Slashes and Backslashes, Oh My

3 minute read

Slashes and backslashes can be difficult to tell apart--they look pretty similar, and to make matters worse they're both used in describing the location of a file. Hopefully you'll have an idea of the difference when you're done with this article.

Part 1: Telling Slashes and Backslashes apart

  • This is a forward slash (often known simply as slash): /
  • This is a backslash: \

If you have difficulty remembering which is which, try this:

  1. Imagine the two characters forming a hill, like so: /\.
  2. On the left side (forward slash), you go up the hill. On the right side (backslash) you go "back" down the hill.
Here are some differences:
  • The forward slash is located on the same key as the question mark.
  • The backslash is located between the Enter and backspace keys and is on a slightly longer key than normal. (On specialized keyboards, the backslash can get moved to all sorts of places.)
  • A forward slash is used for writing English text.
  • A backslash is usually used only in computer contexts.

Part 2: When to Use (Back)slashes

1. In filename paths:
Here are some ways of specifying the location of a file, several of which you probably recognize:

ii. C:\Windows\system32\progman.exe
iii. /home/soren/code/scripts/
iv. \\SERVER\Music
v. smb://SERVER/Music

(i) is a URL for a page on the World Wide Web. Web addresses always use forward slashes. You can probably get away with typing backslashes and have the page still load, but doing so is poor form and may occasionally not work. Please don't say "backslash" when reading a web address--it annoys some people to no end.

(ii) is a Windows file path. These paths always use backslashes. You can supposedly use forward slashes if you want, but many programs will not accept paths typed with forward slashes.

(iii) is a UNIX or Mac OS X style path. These always use forward slashes. These systems will usually not accept backslashes, because the backslash is used for something else (more on that in a minute).

(iv) is a UNC path, used to specify the location of a device or file on a network in Windows. This uses backslashes, though forward slashes will often work.

(v) is another way of specifying a network resource, usually used on UNIX-like systems. This uses forward slashes.

In short, Windows uses backslashes, while UNIX and Mac OS X systems use forward slashes. Most importantly, Web addresses always use forward slashes.

2. Other Uses

Forward slashes can also be used:

  • as a symbol for division (as in 6 / 3)
  • to precede a command in a chat client or other program (as in /quit)
  • to show italics when only plain text is available (like /this/)
  • To indicate command-line options in Windows (dir/p)

Backslashes can also be used:

  • as an "escape" character, to modify the meaning of the following character. This is a common feature on Unix and Mac OS X command lines. For example, if a space would normally mean the end of a command or name, but the command or name contains a space, it would be written like this: word1\ word2
  • to indicate integer division, where any fractional result is cut off (7 \ 2 = 3)
  • to indicate that a line of text or program code does not end but should be carried over to the next line (this is the first part of the line\
    and this is the second part)

There are even more uses for these two simple characters in computing; if I didn't bore you out of your mind, you can check out Wikipedia, at and

Soren "scorchgeek" Bjornstad

If you have found an error or notable omission in this tip, please leave a comment or email me:

Copyright 2011 Soren Bjornstad.
Verbatim copying and redistribution of part or all of this article
is permitted, provided this notice is preserved.