1. Choose any server Choose any server
  2. Right click - Inspect element (or press f12)
  3. Click console Click console
  4. From console copy the websocket ip -> 'ws://x.x.x.x/x'
  5. write connect("ws://x.x.x.x/x") example: connect('ws://')

These steps will allow to connect to a specific server. This way you can play with your friends in the same server.

My question is is there a way to open a web socket via url bar? For example is there a way to write something like http://ws:// for directly connecting to a server?

  • hey. Please don't attach any answers to your question. Answer your own question yourself instead, using the answer function. after that, you can accept it. This way, you'll get some upvotes because your post is actually very useful
    – Blauhirn
    Commented Jun 2, 2015 at 22:55
  • 3
    My question is different than how you understand then. I want an easy solution. I gave the bad solution. It is not possible to do without giving the bad solution.
    – Thellimist
    Commented Jun 3, 2015 at 4:11
  • 2
    You block ads? Everyone knows cells who block ads die quicker.
    – user114959
    Commented Jun 14, 2015 at 1:10
  • This question is older, but I believe the answers on the other question are more up to date. Therefore, this should be closed as a duplicate of that question.
    – Frank
    Commented Jul 15, 2015 at 12:19

3 Answers 3


UPDATE: There is an other way

I was just reminded of another way to connect to an custom Agar.io server. And it's so incredibly simple.

Navigate your browser to the normal Agar.io address, but add a query at the end of the url like so:

http://agar.io?[ip address here]

Please note that you should not enter the ws:// prefix. Here is an example:


And you do not prefer to do so, you may use the updated bookmarklet:

javascript: location.href = "http://agar.io?" + prompt("IP Address", "XXX.XXX.XXX:XXXX"); void 0;

Another more user friendly bookmarklet created by @E. Sundin. It's a jumble of text, but it works:

javascript: if(window.location.host%20!%3D%3D%20%22agar.io%22)%20%7Bwindow.location%3D%22http%3A%2F%2Fagar.io%2F%22%3B%7D%20else%20if(typeof%20_ws%20%3D%3D%3D%20%22undefined%22)%20%7Bvar%20server%20%3D%20prompt(%22Server%20url%22%2C%20localStorage.getItem(%22__server%22))%3Bconsole.log(%22Selected%3A%20%22%20%2B%20server)%3BlocalStorage.setItem(%22__server%22%2C%20server)%3Bwindow._ws%20%3D%20WebSocket%3Bwindow.WebSocket%20%3D%20function(a%2C%20b)%20%7Bvar%20_server%20%3D%20localStorage.getItem(%22__server%22)%20%7C%7C%20%22%22%3Bif(_server.length%20!%3D%3D%200)%20a%20%3D%20_server%3Bconsole.log(%22WebSocket%20opened%20with%3A%20%22%20%2B%20Array.prototype.join.call(arguments%2C%20%22%2C%22))%3Breturn%20arguments.length%20%3D%3D%3D%202%20%3F%20new%20_ws(a%2C%20b)%20%3A%20new%20_ws(a)%3B%7D%3B%7D%20void%200%3B

EDIT: This no longer works

This function was removed by the dev and this is now broken. I will keep it here for reference.

The dev has also added a new game mode, Party. With that you can connect with your friends. At the moment it only works with FFA rules.

Of course if you want to play Any of the other modes, again you can connect to the server via the country selection as the same time as your friend.

Broken stuff:

Actually, yes there is.

Paste this into the address bar while on the Agar.io website:

javascript: connect("ws://" + prompt("Server IP", "XXX.XXX.XXX.XXX:XXX")); void 0;

Now most browsers will remove the javascript: from the start as a security measure; you just need to go back there and add it.

It will prompt you for the server IP. Please don't add ws:// at the start, include the whole IP with the port number.

As well you can bookmarklet the JS code. You can easily bookmarklet the code with my bookmarklet tool located here. For more on bookmarklets, see here.

I would also like to mention something else. When you connect to the server on a specified port you will not always be on the same game.

The second you connect to the port, the server selects a game with the least amount of players from that port. If the all of the games from that port is full, it will display an error and try a different server.

Connecting to a server this way is not reliable, especially if you want to join the same game as your friends. It might cause you some grief.

The only way around this I can see is to connect to the same server at the same time hoping that the server will select the same game for you and your friend. Of course this is not always the case.

  • 1
    I use firefox and tried that with my brother, we both had the same problem somehow. I then see only the agar background without anything to do there.
    – codepleb
    Commented Jun 23, 2015 at 11:41
  • 1
    Yeah I know that, I really did exactly what you said. The dialog also comes up. I also wrote the "javascript:" since this really got deleted by firefox if you copy&paste. The IP I typed in isn't a local IP address if you think that. It's an IP address with mostly the ports :443 oder :XXXX something with 4 digits, 1505 or similar. I may retry it this evening if you say that it should work. I didn't pay much attention to the "join at the same time" part. :)
    – codepleb
    Commented Jun 23, 2015 at 14:43
  • 2
    It doesn't seem to work anymore, it says undefined length
    – lramos15
    Commented Jun 24, 2015 at 23:58
  • 1
    This might work for private servers but for other servers (only tested FFA) I wrote this gist. One could make it a bookmark.
    – E. Sundin
    Commented Feb 21, 2016 at 21:19
  • 1
    I created this bookmark of the above gist. Could you include this in your answer?
    – E. Sundin
    Commented Feb 21, 2016 at 22:07

You can use the Chrome plugin for it.

You just type the IP address out in the Start GUI.


Agar.io just started to support http://agar.io/?XXX.XXX.XXX.XXX:PORT url.

Example: http://agar.io/?

The IP can be found the same way. Press f12 or right click - inspect element - console

enter image description here

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