How to Prank Your Friend by Hacking DNS on His/her Computer




Introduction: How to Prank Your Friend by Hacking DNS on His/her Computer

About: We're Brothers who love internet

Do you have a friend, who constantly uses internet? Have you ever wanted to prank him/her? Well, in this instructable you'll learn how to do this.

In this instructable you will learn how to hack Domain Name System (DNS) on Windows, in order to redirect users from normal site (for example: to another website (which may be running on localhost). This is done by modifying hosts file, the main purpose of existence of this file is to assign website's ip addresses to their domains (see picture).

Things Needed:

* Friend's computer running windows

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Get Access to Your Friend's Computer

In order to prank your friend, first you must get access to his/her computer. Wait for perfect moment when he/she will go to another room, and that's it, you have access to your friend's computer

Step 2: Open Hosts File

So now, after getting access to your friend's computer, create new folder on desktop and call it whatever you want, and open it, then open new window and go to following directory: C:/Windows/System32/drivers/etc/

This is where hosts file is located, now copy that file to new folder that you've made and double click it. It will ask using which software you would like to open it, choose notepad or any text editing software you prefer. Now you might have a question, why to copy hosts file to another folder and why to not edit it directly? Well, that's because, when you'll try to edit hosts file directly, windows system won't allow you to do so, so in order to overcome this, hosts file must be copied to another, non-protected directory (e.g. folder that we've made on desktop) see pictures for graphical instructions.

Step 3: Editing Hosts File

So, this is where you hack DNS, after opening hosts file (step 2), it would looks like this:

# Copyright (c) 1993-2009 Microsoft Corp.
# # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # # source server # # x client host

# localhost name resolution is handled within DNS itself. # localhost # ::1 localhost

so as you can see everything inside that file is commented out. Now here's what you have to do:

as you may already know hosts file assigns ip addresses to their domains (see picture), so that means if you'll add domain (for example:) and tell hosts file to assign some ip address to it (for example:, when user will open browser and type, computer will automatically redirect him/her to website running on . The way you do this in hosts looks like this: the domain which we are going to use is and the ip of the site to which we are going to redirect users is, so to do this add this in hosts file:

it's important to add both domains: with www. and without it. after you finish click save.

(Note: if domain or IP address that you have entered doesn't exists, then it wouldn't work, use existing domains like and etc, and IP's for example site ip which is running on localhosts, to get websites (like IP's see last step.)

Step 4: Replacing Hosts File

So, after you have done editing and saved hosts file in new folder, you have to replace system hosts file with your edited version, (IMPORTANT: Before doing this make sure that you've made a backup of old hosts file which is currently located in C:\Windows\System32\drivers\etc) to do this, right-click your edited version and click copy, then go back to C:\Windows\System32\drivers\etc and click paste button, windows will ask you to provide administrator permission, click Continue button and you're done. Now when you'll go to site which domain you have entered you will be redirected to site which IP address you have entered.

Step 5: Done!

So after you have finished everything, wait for your friend to come, when he/she will open browser and go to domain which you have entered in hosts file, he/she will be redirected to different site (site which ip address you have entered in hosts file), he/she would think that site is hacked or his/her computer is broken :). For better effect use site which your friend uses most frequently, he/she would start panic. Then after few minutes, tell him that you've pranked him.

Now to restore everything, take the backup file that you've made and replace hosts file in C:\Windows\System32\drivers\etc

If you don't have backup, dont worry, you can download it from here.

We hope you liked this tutorial, be sure to favorite, comment and follow. Thank you very much!


Step 6: Get IP Address of Site

In order to redirect to site you can't just enter it's domain, you have to enter it's IP. So how to get site's IP address? well that's pretty simple, all you have to do is to choose site which IP address you want and open Command Prompt (cmd.exe) and type this command:

ping [site domain e.g.]

For example, if you want to find IP address of type this command:


and you'll get response, which looks similar to this:

Pinging [***.***.***.***] with 32 bytes of data:

inside [] brackets is ip address of site, just write that IP down and that's it, you now have found site's IP address.

Be the First to Share


    • LED Strip Speed Challenge

      LED Strip Speed Challenge
    • Sculpting Challenge

      Sculpting Challenge
    • Clocks Contest

      Clocks Contest

    7 Discussions


    1 year ago on Introduction

    Not DNS hacking what so ever, this is modifying the hosts file, not ever touching DNS anything, i highly recommend you do a little studying to learn the proper terms if you are going to do any instructables because otherwise you are teaching people misinformation.


    4 years ago

    Internet Download Manager 6.23 2015 Final + (23) (64) Life Time Patch

    Password Patch : 1234567az


    4 years ago on Introduction

    Is doing this on school computers illegal?

    Maybe I should get my principle in on this, do it to my homeroom teacher for jokes sake...


    Reply 4 years ago on Introduction

    Thank you for your good feedback, it means a lot for us!


    4 years ago on Introduction

    Wow, this prank is brutal! Please let your friend in on it after the prank is over.