HTML Back to Top Button Code

Add a customizable Back to Top button to help visitors zip to the beginning of any page, reduce friction, and keep reading longer – no coding knowledge needed.
4.8 rating
10,000+ reviews
Free plan available
Create Widget for Free
No credit card needed
HTML Back to Top Button Code

Create your Back to Top widget

Configure your Back to Top button and add it to your HTML website for free!

Screenshots

HTML Back to Top Button Code
1 / 6

Why People Love Elfsight

Wouldn’t it be nice if your website just guided people effortlessly? The Elfsight Back to Top widget does exactly that. It gives readers a friendly shortcut to jump to the start of a page, making long pages feel lighter and easier to explore. Setup takes minutes and works even if you’re not a tech wizard – just copy a small snippet of HTML code, paste it into your website, and you’re ready to roll.

If you’ve ever wondered how to make a Back to Top button in HTML, this widget saves you the trouble of coding from scratch. It takes care of the design, animation, and placement automatically.

Did you know?

Nielsen Norman Group found that users spend most of their viewing time near the top of a page.

Start using the Elfsight Back to Top widget today to give visitors a speedy way up – you’ll make long pages feel tidy and stress-free.

Key Features of the HTML Back to Top Button

Let’s keep navigation simple, fast, and friendly. Here’s what you can expect day-to-day:

  • Flexible placement: Choose a neat floating button or place it inline inside your content – both are easy to set up.
  • Custom look and feel: Colors, shapes, icons, size, shadow, label – match your branding in a few clicks.
  • Smart behavior: Show after X pixels scrolled, hide on top, add smooth scroll, and adjust scroll speed to your preference.
  • Mobile-ready by default: Looks great on phones and tablets, with tap-friendly hit areas and lightweight performance.
  • Multiple positions: Bottom-right, bottom-left – pick what fits your layout best.
  • Accessibility-friendly: Aria labels, focus states, and keyboard navigation help everyone use it comfortably.
  • No-code install: Copy the small code, paste it where you want it – that’s the whole story.
  • Low weight: Loads fast and stays out of the way, even on content-heavy pages.

Open the editor and test all features – no signup needed

How to Add the Back to Top to HTML

There’re two simple paths depending on where you want the button to appear.

Method 1: Inline Back to Top

Use this if you want the button inside your page content (like after a long article).

  1. Choose a template: Open the Elfsight editor and pick a layout you like.
  2. Style it: Set icon, color, and size, then preview how it looks.
  3. Copy the installation code: Click “Add to website for free” to get your snippet.
  4. Paste into your HTML: Add the snippet where you want the button to appear within your page markup.

Method 2: Floating Back to Top

Great for a sticky button that follows the reader as they scroll.

  1. Pick the floating layout: In the editor, select a floating style.
  2. Adjust position and behavior: Set bottom/right offsets, show-after-scroll value, and smooth scroll.
  3. Copy the installation code: You’ll get a small script block.
  4. Paste before the closing </body> tag: The button will appear on every page where you add the snippet.

Need help? Visit our Help Center for detailed step-by-step guides. You can share ideas in the Wishlist and track updates in the Changelog.

FAQ

Can I set when the button appears?

Yes. You can choose the exact scroll depth (in pixels) before the button shows, so it only appears when it’s actually useful.

Does it work on phones and tablets?

Absolutely. The widget is responsive and tap-friendly out of the box, so mobile readers can jump to the top without pinching or hunting.

Can I customize the design to match my branding?

You can change colors, size, icon style, corner radius, and even add a label. Quick tweak, instant preview, then publish. Prefer something minimal? You can even display it as an HTML back to top link right inside your page content.

How do I install it if I’m not technical?

It’s copy–paste simple. Generate your snippet in the editor and paste it into your HTML. If you can paste text, you can install it. If you ever get stuck, our Help Center has step-by-step guides.

Will it slow down my pages?

The widget is lightweight and loads fast. You can also configure when it appears, which keeps the experience smooth even on long pages.

Pricing

14-day money back guarantee. Risk-free, you can cancel at anytime.
Elfsight Apps
Cross-platform solution
from $0 / month
start with free plan
Unlimited websites
Fast customer support
Free installation help
Special offer for multiple apps
Fully customizable