Learn how to display an image in the console with JavaScript.

How to display images in the JavaScript console of the Browser

As we wrote on our article "How to customize with css your debug on the javascript console", you are able to use CSS to customize the messages on the console as you want. And when we say as you want, we really mean it. Facebook uses style to show a warning to the users when they access the console (due to the selfxss attack):

Console Facebook Stop

Reasonable isn't? But, do you want to use an image instead of a style? You can do it ! In this article you will learn how to display images on the console using the console.image library.

Using console.image

There is no such method in the console as console.image, however thanks to the console.image library written by @adriancooney, you will be able to display images (it even supports gifs) on the console easily. To get started with this library on your project, download a copy of the minified code or the source code and add a reference to the file in your document using a script tag:

<!-- Add a reference from a local file -->
<script src="console.image.min.js"></script>

<!-- Or use a CDN -->
<script src="https://cdn.rawgit.com/adriancooney/console.image/c9e6d4fd/console.image.min.js"></script>

It's worth to say that this only works in the console of the browser and not a terminal in the case of Node.js. After this, you will be able to access the console.image method with JavaScript.

The console.image method expects a URL to the image that should be shown in the console:


You are to able to display base64 data URIs as well:


Have some fun

For unknown reasons, the library allows you to display memes in the console and display some custom text on them (dinamically). For this, you can use the console.meme function. This method expects as first argument the Text that should be placed on the top of the image, as second argument the text that should be shown on the bottom of the image, as third argument the name of the Meme that should be used and as fourth and fifth argument the width and height (respectively) of the image that will be shown in the console:

console.meme("Not sure if memes in dev tools is stupid", "or disastrous.", "Not Sure Fry", 400, 300);


Instead of providing the name of a meme to display, you can change it for a URL of an image instead or its base64 data URI representation.

That should display on the console the following image:

Display image with text on the console

The possible meme options are:

  • "10 Guy"
  • "3rd World Success Kid"
  • "90's Problems"
  • "Aaand It's Gone"
  • "Actual Advice Mallard"
  • "Advice Dog"
  • "Advice God"
  • "Almost Politically Correct Redneck"
  • "Am I The Only One"
  • "Ancient Aliens"
  • "Annoyed Picard"
  • "Annoying Childhood Friend"
  • "Annoying Facebook Girl"
  • "Anti-Joke Chicken (Rooster)"
  • "Awkward Penguin"
  • "Back In My Day Grandpa"
  • "Bad Advice Mallard"
  • "Bad Luck Brian"
  • "Bear Grylls"
  • "Brace Yourself"
  • "Captain Obvious"
  • "Chemistry Cat"
  • "College Freshman"
  • "College Liberal"
  • "Condescending Wonka"
  • "Confession Bear"
  • "Confession Kid"
  • "Confused Gandalf"
  • "Conspiracy Keanu"
  • "Courage Wolf"
  • "Dating Site Murderer"
  • "Depression Dog"
  • "Drunk Baby"
  • "English Motherfucker"
  • "Evil Plotting Raccoon"
  • "First Day On The Internet Kid"
  • "First World Cat Problems"
  • "First World Problem"
  • "Forever Alone"
  • "Forever Resentful Mother"
  • "Foul Bachelor Frog"
  • "Foul Bachelorette Frog"
  • "Friendzone Fiona"
  • "Frustrated Farnsworth"
  • "Fuck Me, Right?"
  • "Gangster Baby"
  • "Good Girl Gina"
  • "Good Guy Greg"
  • "Grandma Finds The Internet"
  • "Grinds My Gears"
  • "Grumpy Cat (Tard)"
  • "High Expectations Asian Father"
  • "Hipster Barista"
  • "Horrifying House Guest"
  • "I Dare You Samuel Jackson"
  • "I Should Buy A Boat"
  • "I Too Like To Live Dangerously"
  • "Idiot Nerd Girl"
  • "Insanity Wolf"
  • "Joker Mind Loss"
  • "Joseph Ducreux"
  • "Lame Joke Eel"
  • "Lame Pun Raccoon"
  • "Lazy College Senior"
  • "Mad Karma"
  • "Masturbating Spidey"
  • "Matrix Morpheus"
  • "Mayonnaise Patrick"
  • "Musically Oblivious 8th Grader"
  • "Not Sure Fry"
  • "Oblivious Suburban Mom"
  • "One Does Not Simply"
  • "Overly Attached Girlfriend"
  • "Overly Manly Man"
  • "Paranoid Parrot"
  • "Pedobear"
  • "Pepperidge Farm Remembers"
  • "Philosoraptor"
  • "Priority Peter"
  • "Rasta Science Teacher"
  • "Redditor's Wife"
  • "Revenge Band Kid"
  • "Schrute Facts"
  • "Scumbag Brain"
  • "Scumbag Stacy"
  • "Scumbag Steve"
  • "Sexually Oblivious Rhino"
  • "Sheltering Suburban Mom"
  • "Shut Up And Take My Money"
  • "Skeptical Third World Kid"
  • "Smug Spongebob"
  • "Socially Awesome Penguin"
  • "Success Kid"
  • "Successful Black Man"
  • "Sudden Clarity Clarence"
  • "Tech Impaired Duck"
  • "The Most Interesting Man In The World"
  • "The Rent Is Too High"
  • "Tough Spongebob"
  • "Unhelpful Highschool Teacher"
  • "Vengeance Dad"
  • "What Year Is It?"
  • "X, X Everywhere"
  • "Yeah That'd Be Great"
  • "Yo Dawg Xzibit"
  • "You're Bad And You Should Feel Bad"
  • "You're Gonna Have A Bad Time"

If you are working with canvas on your document and want to show their result on the console, you can use another library to achieve the same namely console.snapshot.

Happy debugging !

Senior Software Engineer at EPAM Anywhere. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Become a more social person