Hacking Facebook

Wersja Polska

Hacking Facebook with Javascript

now updated for the latest (March 2010) version of facebook!

Because facebook relies so heavily on javascript, and because we can type javascript into the address bar, that means we can “poke” into the workings of facebook to do things that we wouldn’t normally be able to do. It’s not “hacking” exactly, but it employs the same sort of skills hackers use when looking into applications. The best part is that because it’s all using the same control codes (or “API”) that facebook uses, there’s no way for facebook to find out you’re doing it, so it’s totally safe! (I think…) Besides, we’re not going to be doing anything too dodgy, just a few little tweaks ;)

Facebook Hack: Sending your friends offline

Here’s a funny one; if you’re chatting to a friend, get them to paste the following code into their facebook address bar:


It’ll make them go offline! Of course it’s not permanent, they can go back online by clicking the icon as normal, or by giving the same command again

Facebook Hack: Change facebook color

Check this out:

Isn’t that cool? Just use the following code to get your profile colour changed and impress your friends!


Of course, you can use any colour you like; green, yellow,orange, black. It’s also fun to change it to “white” so you can’t see the text. Muahahaha. Again, only you can see it, but it does last until you log out or view certain special pages.

Facebook Hack: Get Chat History Even When Friends Aren’t Online

New: Video Tutorial for this hack.

Here’s a facebook hack that’s actually proven very useful to me in the past. One thing that I find annoying about facebook is that you can’t retrieve chat history if your buddy is offline… well now you can! :)

Click onto your friend’s profile page and copy their facebook ID from the address bar; i.e. the number after “id=”, highlighted in red below:

It might look slightly different,  perhaps like this: http://www.facebook.com/home.php#/profile.php?id=123132132213&ref=nf

But the important thing is to copy the number of the user, in our case 123132132213

Then while you’re still on facebook, type this into the address bar:


(with the correct ID of course)

And their chat window will pop up, saying “Jimbo is offline”. And if there’s any chat history, it will be displayed. How neat is that!

You can even open a chat window to yourself by pasting your own ID into the javascript, as seen to the right. You can use it for little notes to yourself, but remember that facebook chat history is cleared every few days, so don’t rely on it.

UPDATE1: A few people have had trouble pasting it in correctly, so here’s how it should look:

UPDATE2: Now that we have facebook usernames, it can be little harder to determine the ID of a profile, but it’s still possible – here’s one way: right click the “see all” friends link and choose “copy link location”, like so:

Or in Internet Explorer, you can choose “open link in new tab”. The resulting URL will look something like this:


That’s it!

Facebook Hack: Change your name (temporarily)

This one’s a very simple hack that you can apply to any website. As you saw in the screenshot above, I’d changed my facebook to display as “Facebook | Leet Hax0r”. You can do this by using the following javascript:

javascript:void(document.title="Facebook | Neo");

Sadly, your friends will only see your actual name, not the new one, but it can make for some amusement in a computer lab class or anywhere where you can show people face to face.

Facebook Hack: Close chat windows

If you’re chatting to a friend and want to close the window, sure you can just click the ‘x’ in the top corner, but isn’t it cooler to do it with javascript? Well no not really, but if you can trick your friend into typing the following code in, you can close the chat window of anyone they’re chatting to:


That will close my chat with “123132132213″. You can send your friends that link with your own facebook ID in it, and it’ll close their chat window with you! And if you happen to know that ID:123 is chatting with ID:321, you can send the following to ID:123, and when they paste it in it’ll close their chat with 321!


Other Facebook Hacks

The hacks above are the most impressive, but there are a few other little things you can do which are mildly interesting:

Bring up notifications:


Bring up online friends list:


Bring up application tab:


Make text bold or underlined in facebook chat: use *stars* for bold text, and _underscores_ for underlined. There is no way to get italic text on facebook; see my comment here about facebook chat italics.

That’s all the hacks I’ve found (but I know there are more). In fact, it’s possible to get your friends to “like”, or “unlike” items, and I think it would be possible to get them to comment and more, but the complexity of the javascript makes it not worth doing, plus you have to get them to paste code into their address bar – there’s no way to do it without getting them to do that.

Facebook Easter Egg: Pirate Language

Here’s a nice little facebook easter egg for you:  Go to the language settings page and scroll to the bottom of the list of languages, and somewhere around there you should see “English (Pirate)” in the list of supported languages.

Choose that language option and avast ye sails fer much facebook silliness.

Facebook Easter Egg: Konami

This one is awesome, thanks to Jim in the comments for letting me know about it.

Click in your status update box and type the following: [up] [up] [down] [down] [left] [right] [left] [right] b a [enter], and then click anywhere on the page to see lensflares:

Facebook Chat Smilies

There are a whole load of facebook emoticons available in the chat window. Here’s the complete list decribing what facebook smileys there are and how to display smilies in facebook chat. This seems to have been first discovered by 20bits.com. This list includes the shark smilie and the new facebook penguin smiley!

facebook happy smiley :) facebook sad smiley :( facebook tongue smiley :P facebook grin smiley :D
facebook shock smiley :o facebook wink smiley ;) facebook glasses smiley 8) facebook cool smiley 8|
facebook grumpy smiley >:( facebook erm smiley :/ facebook crying smiley :’( facebook devil smiley 3:)
facebook angel smiley O:) facebook kiss smiley :* facebook love smiley <3 facebook happy smiley ^_^
facebook happy smiley -_- facebook confused smiley o.O facebook laugh smiley <:o facebook pacman smiley :v
facebook shark smiley (^^^) facebook cat smiley :3 facebook robot smiley :|] facebook putnam smiley :putnam:

I hope you enjoyed that post, please thumb me up on stumbleupon or digg me if you liked it :) Happy Hacking! If you want to learn how to hack, I also have a little hacking tutorial online that you might enjoy.



Related Posts:

, , , , , ,

  1. #1 by Jim on May 8, 2009 - 6:12 am

    Don’t forget the konami code easter egg.
    Then click or type.: you’ll get screen sparkles.

    • #2 by user24 on May 8, 2009 - 6:32 am

      omg that’s amazing! I’ll add that to the article too, thanks!

    • #3 by ShadowCrisis on May 25, 2009 - 12:17 pm

      The Konami Code didn’t work for me. I don’t know what I did wrong?

      • #4 by user24 on May 25, 2009 - 4:00 pm

        click in your status box as if you’re going to write a new status message.

        type the code with your arrow keys (↑↑↓↓←→←→BA(enter))

        click some white space on the facebook page

        • #5 by creepy on June 7, 2009 - 4:19 pm

          to do the konami code you dont actually have to click in the new status message field. you can do it right as the page loads.

        • #6 by mr.snigglepuff on June 18, 2009 - 10:37 pm

          still doesn’t work for me

        • #7 by silver lucy on November 9, 2009 - 11:21 pm

          m’kay, got it to work, now how do i get rid of it? it goes off whilst i’m typing…can’t really see what i’m doing…kinda annoying, but cool at first! what’s the reverse magic trick?

  2. #8 by Glenn on May 8, 2009 - 12:05 pm

    Now if only there was some CSRF goodness we could play with :)

    Here’s another slightly interesting hack [1] from the Camrbidge security guys:

    If Howard the pirate publishes this link to the world, only his friends/people in his network can see it:


    That seems fine, but the security policy applies to the page, and not to the photo. So if you can figure out the locations of peoples’ photos you can see ‘em. For example, anyone can see the above photo by going to:


    So we just need to figure out what the above filename means. The Cambridge guys figured it out to be:


    where “Photo-size is just a character in the set {t, s, n} representing the resolution of the image, uid is the user ID of the user who uploaded the photo, pid is a photo ID, and PIN is a four-digit random number.”

    Slap together a few scripts, and you can stalk away ;) Check out the full article:

    [1] http://www.lightbluetouchpaper.org/2009/02/11/new-facebook-photo-hacks/

  3. #9 by David Batey on May 8, 2009 - 3:19 pm

    Wow this is amazing stuff. Cant wait to have a play with it. :)

  4. #10 by Music Fans on May 11, 2009 - 6:02 am


    Slightly unrelated, but so far i’ve tried everything from adding an image in the meta tags to making it the first image in the code, but facebook still won’t put my logo as the thumbnail when sharing a link. Any ideas, you seem to have managed it in your screenshot above.

    p.s cool hacking of facebook.

    • #11 by user24 on May 11, 2009 - 6:35 am

      heh heh, actually that was quite sneaky of me too:

      I pasted the link into my FB status box, facebook then showed the “hello me” chat image as the thumbnail. So I FTP’ed in to my site and changed that image to the thumbnail I wanted facebook to display, shared the link and then edited the puremango article so that correct chat image was shown.

      Well spotted! You no doubt also noticed that the image that facebook shows doesn’t actually appear anywhere on this page. ;)

      EDIT: although, that sneaky way of doing it only lasts so long; when a friend shared the link within an hour of my posting it, it showed the image I wanted. But now (several days later) if I share the same link, facebook chooses an image from the article itself.

  5. #12 by Rowly on May 13, 2009 - 3:49 pm

    Hey, I’ve stumbled upon underline and bold, but how do you do italics in FB chat??

    In case anyone doesn’t know, bold is *boldwords* and underline is _underlinewords_


    • #13 by user24 on May 14, 2009 - 2:06 am

      Thanks for sharing that, I’d found the bold code before but had forgotten.

      I looked through the code; there is no way to get italics. Check out this javascript snippet from somewhere deep inside facebook’s JS:


      - or in other words, they only support underline and bold.

    • #14 by big bunny on November 23, 2009 - 5:14 pm

      if it cumms up bold left click it and del it and right it again it always works for me i do loads ov hacking i hack games owt u can fink ov need any help mail me at perrybarnes2005@hotmail.co.uk

  6. #15 by Kaitlin on May 18, 2009 - 8:18 pm

    There is also a shark emoticon.

    • #16 by user24 on May 18, 2009 - 10:02 pm

      wow, thanks, I’ve added that to the article.

      That must have been added very recently; it wasn’t in the code when I looked the other day!

  7. #17 by Sed on May 26, 2009 - 3:33 am

    Hey, this stuff is very cool and I would love to try it. But all of it involves pasting a code into the “facebook address bar”. Can u explain exactly how to do it please? I’ve tried it and none of it worked. I must be doing something wrong.


    • #18 by user24 on May 26, 2009 - 4:48 am

      just paste the javascript into your browser’s address bar, as if you were pasting in a URL.

      So where it says “http://www.facebook.com/home.php” or something similar, just paste the javascript code there and press enter.

      • #19 by Sed on May 27, 2009 - 1:09 am

        Oh, I’ve been doing it right then. But it’s not working for some reason. The code just stays there after I paste it and press enter, and even if I refresh the page, but nothing really happens. I even tried separating the code from the facebook address with a space or a dash, but it still didn’t work.

        • #20 by user24 on May 27, 2009 - 7:18 am

          you need to replace the whole facebook address with the javascript code. I can’t see why they wouldn’t work apart from that.

          Refreshing the page won’t help; these hacks only take effect while you’re on the same page.

          The code will stay there but you should see an effect on the facebook page, like the chat window popping up/disappearing etc. Have you tried all the different codes?

          • #21 by Sed on May 27, 2009 - 7:46 pm

            Oh! Got it! I was ADDING the code to the facebook address. I tried replacing it and it worked fine.
            Good job on figuring these out, they’re certainly useful.

  8. #22 by Trent on May 26, 2009 - 7:17 pm

    Hey man, can’t figure out the Konami one?

  9. #24 by cheypie31 on May 27, 2009 - 11:33 am

    i dont get the chat with yourself one.

    • #25 by user24 on May 28, 2009 - 7:29 am

      well, just go to your own facebook profile page and get your ID number from the address bar, then paste the code (javascript:buddyList.itemOnClick(123132132213);) into the addressbar, using your own ID instead of 123132132213. That’s all there is to it!

      I’ve used it a bit to test out smileys etc.

      • #26 by ss on June 5, 2009 - 4:54 pm

        it didn’t work :(:(:(:(

        • #27 by me on June 6, 2009 - 5:35 am

          Just paste this:


          into your address bar, but replace XXX with your own profile ID.

      • #28 by sarah on June 17, 2009 - 9:33 am

        now that FB has usernames, how can you pop up your own chat window?

        • #29 by user24 on June 17, 2009 - 9:41 am

          Yeah, you can still find IDs floating around the facebook page; like if you hover over the number of friends you have, or a photo gallery, you can see your ID come up in your browser’s status bar. I’ll see if there’s a better way sometime.

          Article updated.

  10. #30 by amar on June 7, 2009 - 2:50 am

    i want to learn hacking

    • #31 by user24 on June 7, 2009 - 4:06 am

      Thanks for the comment.

      I put together a tutorial about how to hack a while ago. There’s even a link to it in the post above!

  11. #32 by user22 on June 7, 2009 - 9:52 am

    the konami jiggamathingy still isnt working for me
    even with the other comment you stated above -.-

    • #33 by This konami dows not work on January 23, 2010 - 4:22 pm

      It does not work cause you dont USE EXPLORER

      it only works with internet explorer.

  12. #34 by gaba on June 8, 2009 - 8:33 am

    can this only be done in firefox?

    • #35 by user24 on June 8, 2009 - 1:14 pm

      I just tested it in MSIE 8 and it seems to work fine.

  13. #36 by Mark Mettler on June 8, 2009 - 9:37 am

    Is there a fashion or way by which you can insert a graphic from your computer or Facebook Gallery into a comment you make on someones Facbooknpage? For example: if I wanted to paste birthday ballons in my Happy Birthday comment.

    • #37 by user24 on June 8, 2009 - 1:23 pm

      No, not that I know of – and I doubt there is a way. Would be cool though!

      Although, you can always use ASCII graphics, eg from here

  14. #38 by concerned on June 16, 2009 - 5:04 pm

    Wow! so 8 year olds play with java?

    I mean, really, this is all you have to do with your life?

    • #39 by user24 on June 17, 2009 - 12:34 am

      no, 26 year-olds play with javaSCRIPT. And as you’ll see from the rest of the site, that’s far from all I have to do with my life.

      I mean, really, is trolling all you have to with your life?

      • #40 by Grayson on October 3, 2009 - 7:02 pm


  15. #41 by Jeradin on June 18, 2009 - 2:35 am

    So, I tried to bring up someone’s chat history who isn’t online and he already has a username. I used this method, but I don’t think it works for offline friends anymore. I tried the same thing with someone who didn’t have a username and that one worked just fine, so I don’t think you can bring up offline chat histories if the other person has a username.

  16. #42 by Jeradin on June 18, 2009 - 2:40 am

    Nevermind. I got it to work now.

  17. #43 by shaa on June 18, 2009 - 12:21 pm

    well i havent gotten mine to work yet… like jeradin, the person got a username. what to do, what to do?!?

    • #44 by user24 on June 18, 2009 - 2:03 pm

      Search this page for “update2″ (no spaces) – I’ve amended the article with some instructions on getting IDs for username’d users.

      • #45 by shaa on June 25, 2009 - 11:24 pm

        thanks :) :)

  18. #46 by Cody on June 24, 2009 - 5:38 pm

    just trying 2 use the java thing on facebook isnt workin for me not sure if im addin it into the addressbar right

  19. #47 by claudia lewis on June 30, 2009 - 1:50 am

    i’m hacking my sister’s facbook

  20. #48 by lulz on July 2, 2009 - 4:55 pm

    i couldn’t get a chat window open with an offline person who has a username. i got his id # from the page using update2 but it won’t open a window.

    • #49 by user24 on July 3, 2009 - 1:24 am

      So you just need to delete everything in the facebook address bar, then paste this in:


      with the correct ID number, and press enter.

      If nothing happens then you must have the wrong ID number.

      • #50 by noed265 on August 11, 2009 - 10:30 am

        there is not supose to be a simicolon ; after the last bracket )

  21. #51 by Edoardo on July 5, 2009 - 6:38 am

    You’re just changing a couple of things client-side with a bit of javascript… not really “hacking” at all.

    • #52 by user24 on July 5, 2009 - 8:26 am

      That’s absolutely correct. Which part of “It’s not “hacking” exactly” didn’t you understand? It’s on the fourth line of the article :P

  22. #53 by Custopootimus on July 11, 2009 - 5:14 am

    Edit any page:
    javascript:document.body.contentEditable=’true’; document.designMode=’on’; void 0
    Dancing images:
    javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.images; DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position=’absolute’; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+”px”; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+”px”}R++}setInterval(‘A()’,5); void(0);

    • #54 by user24 on July 12, 2009 - 8:12 am

      cool! Nice additions. They’ll work on any website, too ;0)

    • #55 by criptozoic on July 15, 2009 - 4:42 pm

      I was wondering if you could give some instructive words of advice on how to use these codes. Thanks! ;P

    • #56 by criptozoic on July 16, 2009 - 4:46 am

      Never mind, I figured it out – it seems your apostrophes and quotation marks weren’t the correct ones. I replaced them with mine and the code worked perfectly.

    • #57 by bulldawg on October 25, 2009 - 5:49 am

      is there any way you can save the changes you make to the page?

  23. #58 by exes on July 21, 2009 - 12:00 pm

    I just had to commend…and uber show my deepest appreciation for sharing this :”Facebook Hack: Get Chat History Even When Friends Aren’t Online”

    I am truly thankful I’ve stumbled upon your site!
    The “hack” worked and I finally got the number I needed from the chat history(since we just happened to talk hours ago but the laptop suddenly restarted)

    Im not faking this at all. It really really worked for me.
    again,thank you and have a good one!

  24. #59 by katrina on July 30, 2009 - 12:51 am

    pls hack this id in facebook

  25. #60 by Jet on August 9, 2009 - 12:47 pm

    I tried seeing someones chat messages from the 2nd update! I dont know why it isnt working… the view everyone made me see all the persons friends which is pretty cool but not what I was looking for.

    Is there a way to see private mesages?

  26. #63 by Serene on August 13, 2009 - 6:02 am

    I tried doing this but how comeI can not retrieve previous chats? Does this code can only be applied on chats made on same day or the time you recently logged in? I need to retrieve chat history as in history like few weeks or a month ago.

    • #64 by user24 on August 13, 2009 - 6:38 am

      facebook only stores history for a few days, sorry.

  27. #65 by Lvl12 on August 14, 2009 - 1:53 pm

    i luvv all of ur hacks except for the lensflare it wont work

  28. #66 by Loretta Cund on August 26, 2009 - 3:27 pm

    fukin hell

  29. #67 by hi on August 31, 2009 - 10:56 am

    dude….y is it u a hacker n u using windows vista or 7….or u jst made ur linux system look like that…..i kwn its ait..too use it but y nt jst use a linux system instead or was this done on office system

    • #68 by user24 on August 31, 2009 - 12:31 pm

      heh, you’re right I do run windows at home. I keep saying to myself I’ll move over to fedora at some point, but I’m so used to the way the windows desktop works. I have a linux shell account as well though ;0)

  30. #69 by Darky on September 2, 2009 - 10:22 am

    Ok, i found another funny language xD
    English(Upside Down) !!!! u can find it like English (Pirate)

  31. #70 by Marr on September 4, 2009 - 9:17 am

    I Am LOVING The Pirate Language XD
    Officially My New Fav Thing About Facebook ^^ ARRR

  32. #71 by Johnsye on September 5, 2009 - 3:09 pm

    Hey, about the lens flare thing, i got it down, but the sparkle one i dont get, and my lens flare only stays for like 0.8 seconds, do you know how i can keep it there for a while?

    • #72 by guest on October 20, 2009 - 8:54 pm

      Try scrolling. when I used lensflare, it popped up everytime I scrolled.

  33. #73 by M4++y on September 10, 2009 - 11:01 am

    Alright Alright Alright, so I thought hey, why not try to get people to click a button on my profile and then it logs them out. So I did some exploring of some facebook apps and found this:

    Just search applications for “html profile box”. Then u can put some of your own script into a box in ur profile(which u can move from Boxes to your Wall for people to see easily)

    Anyway all seems to work fine. You can’t use this bo to affect your profile and u need to remember not to use (it doesn’t need or want to see this), and hence you cant affect the body of the box itself, ie if u want to change the bacground colour of it you should put in a table first.

    Javascript doesn’t seem to work. (which was the purpose for which I installed this app) Any ideas??

    (but I did have some fun inviting people to type their facebook password(jokingly of course) and suggesting they click a button that e-mails whatever they typed to me (assuming they have home-based e-mail)

  34. #74 by M4++y on September 10, 2009 - 11:05 am

    err in my above message this forum seems to eliminate html script from posts. let me retype the third paragraph

    Anyway all seems to work fine. You can’t use this box to affect your entire profile and u need to remember not to use the body tag(it doesn’t need or want to see this), and hence you cant affect the body of the box itself, ie if u want to change the bacground colour of it you should put in a table first.

  35. #75 by supersniper on September 20, 2009 - 11:15 am

    There’s a new emoticon

    the penguin


    Try it out ;)

  36. #76 by Faz on September 23, 2009 - 8:24 am

    Is there a way to retrieve my facebook chat even after i cleared the chat history before i logged off? I have a bad habit of doing that, and now i need to prove a point :)

    I tried the code you have listed, the name flashes up, but no chat..

    • #77 by user24 on September 30, 2009 - 8:19 am

      no, sorry,

  37. #78 by sunshine87 on October 6, 2009 - 8:25 pm

    very interesting stuff…but i have lost my fb password, actually my dad changed it and forgot it, but i need to get into my own account. can anybody help me!? i’ve already contacted fb and they really aren’t doing anything. oh and my back up emails are so old they were deleted and my dad changed my gmail account as well and lost that password. i need help with that one as well.

  38. #79 by amadtattoo on October 8, 2009 - 10:31 am

    i love this articel
    thanks for share

  39. #80 by Jeremiah on October 20, 2009 - 10:46 am

    What if you have removed the person from your friends list, and you need some very crucial information from that particular chat?

  40. #81 by guest on October 20, 2009 - 8:58 pm

    Tip on lensflare effect : try using the numpad to scroll and it makes thge lens flare to happen everytime you scroll/click. It worked for me when the method you had (^ ^ v v B A [enter]) didn’t work. bad thing is, you have to refresh to get rid of it.

  41. #82 by Steph on October 31, 2009 - 4:08 pm

    I’m trying the javascript thing to view chat history, and I was talking to this person 30 minutes ago, and I know I have the right userid, but it’s not working. Does it not work on Safari or Firefox, or is OS X the problem, or the Facebook redesign, or am I somehow doing it wrong, or what?

    • #83 by user24 on October 31, 2009 - 6:50 pm

      I have tested it recently and I know it still works so it’s not the FB redesign. Could be OSX I guess. Did you follow the video instructions? I think they’re clearer. Link is above.

  42. #84 by john on November 3, 2009 - 4:05 pm

    i did a couple spin-offs of the menubar code. they edit the color of the main body and text (only some of iut)

    body– javascript:void(document.body.style.background=’red’);
    text– javascript:void(document.body.style.color=’red’);

  43. #85 by Student Brands on November 4, 2009 - 9:47 am

    Thanks for the great info, we hope to use this on our website soon, http://www.studentbrands.co.za its a free student portal

  44. #86 by ti poule on November 6, 2009 - 2:22 pm

    i really want to know how to hack facebook password??

  45. #87 by Daniel on November 9, 2009 - 6:32 pm

    I really want to know how to hack a facebook password as well..
    can it be done ?

  46. #88 by Daniel on November 9, 2009 - 7:35 pm

    and a while after i wrote that message some one did? lol
    so can ne one help me out please?

  47. #89 by jimmie on November 10, 2009 - 8:15 pm

    hey, your article is very good. and its helping so much. i have fun with it
    but, i really want to know how to hack a profile. to enter a facebook profile (my friend) and just have fun with it..
    can you tell me how to hack a profile, without the password?

  48. #90 by Nope on November 16, 2009 - 6:37 am

    They all say Couldn’t retrieve chat history

    so… i dunno what ur talking about

  49. #91 by Rocky on November 19, 2009 - 2:48 pm


    makin toolbar red

  50. #92 by yoyo on November 22, 2009 - 7:39 pm

    where do u add the color changing codes

1 2 3

Comments are closed.