The default /etc/hosts file looks like this:   localhost broadcasthost
::1 localhost
fe80::1%lo0 localhost

If I want to insert a custom item, should I insert it after the first line?   localhost   website.dev

Or should I add it after the last line?

fe80::1%lo0 localhost   website.dev

I've seen both, but can anyone explain what the difference is?

2 Answers 2


You can add it anywhere you want in the body of the file.

Additionally the following works also:   localhost website.dev website.org

and for me even this works (but I don't think it's recommended):   localhost, website.dev, website.org

For the sake of a better overview I prefer:   localhost   website.dev   website.org broadcasthost
...IPv6 stuff...
  • What if we move website.dev above the default localhost, will that cause trouble?
    – Stickers
    Feb 3, 2016 at 19:35
  • @Pangloss No, this won't cause any trouble.
    – klanomath
    Feb 3, 2016 at 19:37

I guess the only difference would be that if you write your own lines after the first one, they will be found earlier than if they are in the last lines. As long as you don't have a huge amount of lines in your /etc/hosts file that shouldn't really make a difference though.

I personally would add my own entries after the last line because I like to clearly separate my own stuff from the system's default stuff.

You must log in to answer this question.

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