There are many instances where by and with mean something completely different, but which is the correct preposition usage in the following sentences?

  • A file by the same name as the original file.
  • A file with the same name as the original file.

Do the two sentences above mean something different, or can they be used interchangeably? What general rules (of thumb) govern the correct usage of the prepositions by and with?

If you rewrite the sentences to

  • A man by the same type of hat as the original hat.
  • A man with the same type of hat as the original hat.

then they obviously don't mean the same. In the former sentence, the man is next to the hat, in the latter, he is wearing or holding it. Is the distinction between a material and immaterial object of the sentence (in this case the hat, in the former case the name) what generally governs the correct usage of by and with?

  • 3
    In constructions involving name and by (such as He goes by the name of Smith, A rose by any other name would smell as sweet) , the highlighted preposition can usually (if not always) be understood as a shortened form of known by [such-and-such a name]. But this doesn't work with your other referents (A man known by the same type of hat doesn't really make sense). Jul 22, 2018 at 12:51
  • 1
    Note that I haven't fully thought this one through, so I'm not sure how "absolute" the above principle is in respect of by + name, and I've no idea whether that or a similar principle might apply to other words besides name. Jul 22, 2018 at 13:29
  • 1
    @FumbleFingersote Yeah, I get that, hence why I wrote "rule of thumb". I don't know whether this can be elevated to a general or "absolute" principle either, but it does seem like a reasonable starting point. After all, there might not be any general principles or rules governing the proposition usage that I'm asking about.
    – Miqi180
    Jul 22, 2018 at 13:57
  • In the context you asked bout, there is no difference. Aug 4, 2018 at 20:58

3 Answers 3


In the second example, the use of "by" could indicate physical proximity to a hat, whereas "with" suggests the man has the hat. In cases where there is a possible physical interpretation, it is better to use "with" (assuming you do not intend to convey that the subject is near an object). In cases where there isn't a possible physical meaning to confuse, "by" works to identify something. "By" as an indication of identity is particularly clear when you specify cases such as example one, where existence of a name is referred to. This fits into implicit phrases like "goes by" or "known by" as suggested in the comments.


There is no rule for "by" and "with". The dictionary defines "by" and "with" and demonstrates how they are used.

by: to show purpose or method (by walking, by explaining)

by: to show proximity (The post office is by the gas station.)

by: to show agent (It was picked up by Pete.)

with: = accompanying or staying together (I am with him. I have two files with the same name. The man with the top hat looks funny. Are any conditions included with that?)

  • This doesn't answer the question of What rule governs the usage of “by” versus “with”? Nov 25, 2019 at 6:11
  • There is no "rule". "By" and "with" have definitions in the dictionary that explain how they are used. I'll revise my answer to say "There is no rule." Nov 25, 2019 at 6:17
  • I'm struggling a bit to see which of your listed categories of by usage the sentence "a file by the same name..." falls under. Surely not "purpose or method" and definitely not "proximity", but I don't see how it could be "agent" either, so something else seems to be going on here. Maybe because "by" is shorthand for "known by" in this case? However, you may still be correct in saying that no general rule exists.
    – Miqi180
    Nov 26, 2019 at 21:38
  • The dictionary? 'The dictionary' would have to be OED. M-W is pretty thorough, giving 19 senses (some listed as subsenses) and arguably doesn't cover the usage involved here. Dec 25, 2019 at 13:12

Although "by" could potentially mean "next to" as used in your examples, used as you describe it is almost always acting as shorthand for "going by". The full unabbreviated sentence would be: "A file going by the same name as the original file."

This is why you don't see "by" used as in your second example. "A man going by the same type of hat." makes no sense.

It's similar to cases like "Going out the window" vs. "Going out of the window." It's just such a common expression that an otherwise illogical shortened version has become commonly accepted and understood.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.