Learn to Code via Tutorials on Repl.it!

← Back to all posts
How to Make a Download Button!
PowerCoder (623)

This will be a simple and useful tutorial on how to add download buttons.

In your HTML file make an anchor tag:


Then, add the content you want to download in the href attribute:

<a href="test.png">Download</a>

Lastly, to add a name to the file that the user is going to download, add the name in the download attribute:

<a href="test.png" download="Test-file">Download</a>

Now, if you click on our download button, it should download the file.

Coder100 (10604)

This will work only sometimes
This is purely due to browser behavior.
Nice tutorial btw!

PowerCoder (623)

@Coder100 I didn't know that 🤔. And thank you 😀!

JacksonPhilips (66)

Very helpful! :+1:

Edit: I keep forgetting I can't use emojis like that in Repl.it markdown smh

PowerCoder (623)

Obrigado (eu literalmente usei o Google Translate para isso)

MemeManHimself (92)

@PowerCoder lol é isso que eu faço para qualquer idioma que eu não conheço (e eu falo inglês btw)

PowerCoder (623)

@TheMemeManHimse Oh. Está bem. Basta falar inglês nesta plataforma. Infelizmente, ninguém sabe português aqui.

MemeManHimself (92)

@PowerCoder Ech maachen normalerweis: D lol awer um ok dann op d'mannst erausfannen

theworldoflucks (3)

This was really useful thanks!

techgeek680 (70)

@PowerCoder I just registered today, and I had a FaceTime call with my friend. Now I know a little bit more.

techgeek680 (70)

@PowerCoder how did you make the screen black?

PowerCoder (623)

@techgeek680 Cool! In my style.css file, I added this piece of code:

body {
    background-color:rgb(99, 99, 99);

To add a different background to your website background, just change background-color to a different color.


body {
ChezCoder (1552)

the download attribute can be blank:
<a href="test.png" download>Download</a>

PowerCoder (623)

@DannyIsCoding Thank you! I'm glad you enjoyed it :D!



Leroy01010 (380)

making virus's for people to download i'm innocent with this

lurking11 (5)

it didn't work for me , using chrome on manjaro linux distro
anyway well done.

PowerCoder (623)

@lurking11 Hmmm... weird it works for me.

Anyways, thanks you.


it doesn't work