Build Status

Instafeed is a dead-simple way to add Instagram photos to your website. No jQuery required, just good ‘ol plain javascript.


Buy me a coffee:

If you enjoy using Instafeed.js and want to say thanks, you can leave me a small tip. All payments are securely handled through Stripe.

Leave me a tip →


Setting up Instafeed is pretty straight-forward. Just download the script and include it in your HTML:

<script type="text/javascript" src="path/to/instafeed.min.js"></script>

Instafeed.js also supports AMD/CommonJS

// AMD
require(["path/to/instafeed"], function(Instafeed) {


// CommonJS
var Instafeed = require("instafeed");


Instafeed.js is also available on NPM and Bower:

npm install instafeed.js      # npm
bower install instafeed.js    # bower

Basic Usage

Here’s how easy it is to get all images tagged with #awesome:

<script type="text/javascript">
    var feed = new Instafeed({
        get: 'tagged',
        tagName: 'awesome',
        clientId: 'YOUR_CLIENT_ID'

Instafeed with automatically look for a <div id="instafeed"></div> and fill it with linked thumbnails. Of course, you can easily change this behavior using standard options. Also check out the advanced options for some advanced ways of customizing Instafeed.js.


The only thing you’ll need to get going is a valid client id from Instagram’s API. You can easily register for one on Instagram’s website.

If you need help with that step, just try Googling “How to get an Instagram client ID”.

Standard Options

Advanced Options

Example Filter (get username + tagged):

var feed = new Instafeed({
  get: 'user',
  userId: 'USER_ID',
  filter: function(image) {
    return image.tags.indexOf('TAG_NAME') >= 0;

To see a full list of properties that image has, see issue #21.


The easiest way to control the way Instafeed.js looks on your website is to use the template option. You can write your own HTML markup and it will be used for every image that Instafeed.js fetches.

Here’s a quick example:

<script type="text/javascript">
    var feed = new Instafeed({
        get: 'popular',
        tagName: 'awesome',
        clientId: 'YOUR_CLIENT_ID',
        template: '<a class="animation" href=""><img src="" /></a>'

Notice the and? The templating option provides several tags for you to use to control where variables are inserted into your HTML markup. Available keywors are:

Portrait and Landscape Photos

Until June 1, 2016, Instagram’s API will return square images (with white borders), regardless of how they were originally uploaded.

If you’d like to get images in their original landscape and portrait forms, you can opt-in to the API change by editing your Instagram API client, and clicking on the “Migrations” tab:

screen shot 2015-10-31 at 2 02 56 pm

Note: If you have the resolution option set to thumbnail (default), all images will be square regardless of your API settings.

Image Size Template Helpers

As of v1.4.0, Instafeed.js includes several helpers you can use in your template option to work with the new image sizes. These helpers are meant primarily to help control styling of the images through CSS.

Getting images from your user account

To fetch images specifically from your account, set the get and userId options:

var userFeed = new Instafeed({
  get: 'user',
  userId: 'YOUR_USER_ID',
  accessToken: 'YOUR_ACCESS_TOKEN'

Note: YOUR_USER_ID option corresponds to your Instagram account ID (eg: 4385108), not your username. If you do not know your account ID, do a quick google search for “What is my Instagram account ID?”. There a several free tools available online that will look it up for you.


As of v1.3, Instafeed.js has a .next() method you can call to load more images from Instagram. Under the hood, this uses the pagination data from the API. Additionall, there is a helper .hasNext() method that you can use to check if pagination data is available.

Together these options can be used to create a “Load More” button:

// grab out load more button
var loadButton = document.getElementById('load-more');
var feed = new Instafeed({
  // every time we load more, run this function
  after: function() {
    // disable button if no more results to load
    if (!this.hasNext()) {
      loadButton.setAttribute('disabled', 'disabled');

// bind the load more button
loadButton.addEventListener('click', function() {;

// run our feed!;

Contributing to Development

This isn’t a large project by any means, but I’m definitely welcome to any pull requests and contributions. Everything is written and tested in CoffeeScript.

You can get your copy up and running for development quickly by cloning the repo and running npm:

$ npm install

This will install all the necessary test tools for testing. There is also a Makefile in the repo to make your tests quick and easy:

Change Log