Black Friday30% off every Squarespell plugin. No code neededOr get all 48 plugins from $15/mo, 14 days freeEnds in05d12h58m32sShop plugins
squarespell

Squarespace

How to Add a Scroll to Top Button in Squarespace (Free Code, Tested on 7.1)

Squarespace has no back to top button, so this guide gives you free tested code for every page, a no-JavaScript version for the Basic plan and two hosted widgets, each set up step by step.

Shahzaib NadeemPublished Oct 20, 2025Updated Oct 22, 202622 min read
Share
Squarespace scroll to top button guide cover showing a test page with a round back to top arrow on desktop and mobile, beside button styles from Elfsight and Common Ninja

A note on how we make money. The two hosted widgets in this guide, Back to Top by Elfsight and Back to Top Button by Common Ninja, are listed on Squarespell with affiliate links, and we may earn a commission if you upgrade through them. The free code in this guide earns nobody anything, and it is still the method we recommend for most sites. Details are in our affiliate disclosure.


Quick answer

If you want the short version:

  • Best for most sites: paste one block of free code into Code Injection, Footer. A round arrow button appears in the bottom right corner on every page once a visitor scrolls 400 pixels, and one click takes them back to the top. We tested it on a Squarespace 7.1 template demo on 22 October 2026.
  • What you need for that: a Core, Plus or Advanced plan. Squarespace’s Basic plan can’t run JavaScript in Code Blocks or Code Injection.
  • On the Basic plan: use the no-JavaScript version in a Code Block in your site footer. It works on every plan; in browsers that support scroll-driven CSS it stays hidden at the top of the page, in others it is always visible.
  • If you would rather not touch code: Back to Top by Elfsight and Back to Top Button by Common Ninja are hosted widgets with free plans and visual editors, but you still paste one embed code and they load from the vendor’s servers.
  • Only on one long page: paste the same free code into that page’s own Header code injection instead of the site-wide Footer.

And the honest caveat before any of that matters: Squarespace has no built-in back to top button in version 7.1, so every route here is added code. Squarespace’s support team doesn’t help with custom code, and a later Squarespace update could change how it behaves, which is why the code below is short and easy to remove.

Last updated: 22 October 2026

A scroll to top button (also called a back to top or go to top button) is the small arrow that sits in a corner of a long page and takes the reader back to the header. On Squarespace it matters most on long blog posts, services pages with many sections and shop categories with dozens of products, especially on phones, where scrolling back up takes many swipes.

This guide replaces our original 2025 tutorial. We rewrote the code from scratch, ran both free versions on a Squarespace 7.1 template demo in Chromium, and found two Squarespace-specific problems the old code did not handle: the site footer traps a fixed button underneath page content, and template CSS can override your animation and scroll settings. Both are fixed in the code below. We also looked at the two hosted widgets listed on Squarespell for readers who want a visual editor instead.


What’s in this guide

  1. Which method fits your site
  2. What you need before you start
  3. Method 1: free code for every page
  4. Method 2: no JavaScript, for the Basic plan
  5. Show the button on one page only
  6. Method 3: Back to Top by Elfsight
  7. Method 4: Back to Top Button by Common Ninja
  8. Free code or a widget: the comparison
  9. Change the colour, size, position and label
  10. Related: progress bars and jump buttons
  11. Troubleshooting
  12. What we couldn’t verify
  13. FAQ
  14. Where to start

Which method fits your site

Two questions decide it: which Squarespace plan you are on, and whether you want to edit the button in a visual editor or are happy changing a few values in code.

MethodPlan neededCostWhere it goesBest for
1. Free code, site-wideCore, Plus or AdvancedFreeCode Injection, FooterMost sites: one paste, every page, hides until needed
2. Free code, no JavaScriptAny plan, including BasicFreeA Code Block in the site footerBasic plan sites, or anyone who wants no script at all
3. Elfsight Back to TopA plan that allows embed code (see below)Free Lite plan; Basic $5, Pro $10, Premium $20 a monthEmbed code from ElfsightA visual editor with ready-made button styles and page rules
4. Common Ninja Back to Top ButtonA plan that allows embed codeFree plan; paid plans on Common Ninja’s siteEmbed code from Common NinjaSkins, colour and font controls in a drag-and-drop dashboard

Plan rules from Squarespace’s help centre and Elfsight prices from its Squarespell listing, both checked 22 October 2026. Common Ninja does not state prices on its listing.

Our pick for most readers is Method 1. It is about 80 lines, loads nothing from another server, hides itself until the reader has scrolled, respects the reduced motion setting and works with a keyboard. Pick a widget only if you will genuinely use its editor or its page rules.


What you need before you start

  • Squarespace 7.1. Everything here was checked on a 7.1 template. Version 7.0 notes are in the FAQ.
  • The right plan for your method. Squarespace’s Code Block guide says JavaScript or iframes in a Code Block need the Core, Plus or Advanced plan, and its code injection guide says code injection is available on Core, Plus, Advanced and some legacy plans. On every plan, Code Blocks accept HTML and CSS inside <style> tags, which is what Method 2 uses.
  • Five minutes and a logged-out browser window. Squarespace hides some code while you are logged in, so you check the result in a private or incognito window.
On a plan without JavaScript, the Code Block editor shows this Upgrade note and the block reads “Script Disabled”. That is why Method 2 uses no script. Screenshot from the Squarespace editor, from the original version of this guide.

Method 1: free code for every page

This is one paste into Code Injection, Footer. It adds a round black arrow button to the bottom right corner of every page. The button stays hidden for the first 400 pixels, fades in as the reader scrolls, and on click scrolls smoothly back to the top and moves keyboard focus to your header so keyboard and screen reader users land in the right place.

Method 1 on a test page in Chromium, 22 October 2026: the button appears after the first scroll, then one click returns to the header. The pointer is not visible in the recording; the button turns dark grey when hovered.

Step 1: Open Code Injection

In your Squarespace dashboard, open Website, scroll the panel to Website Tools, and choose Code Injection under Custom Code. If you only see an upgrade message there, your plan does not include code injection: use Method 2.

Website Tools in Squarespace 7.1: Code Injection sits under Custom Code, next to Custom CSS. Screenshot from the Squarespace editor.

Copy the whole block below, including the <style> and <script> tags, and paste it into the Footer field. Squarespace’s guide says code in the Footer field “is injected before the closing </body> tag on every page in your site”, which is what makes the button site-wide. If the Footer field already holds other code, paste this underneath it.

Checked on the alameda-demo.squarespace.com template (Squarespace 7.1) and on a local test page in Chromium 141, 22 October 2026.

Step 3: Save, then check it logged out

Click Save. Open your site in a private or incognito window, scroll down a little more than one screen, and the button fades in at the bottom right. Click it and the page scrolls to the top. Then press Tab until the button is focused and press Enter: it should do the same, with a blue outline showing focus.

The same code at 390 pixels wide. Below 768 pixels the button shrinks to 44 by 44 pixels and moves 16 pixels from the edges. Recorded in Chromium with touch emulation, 22 October 2026.

What the code does, line by line in plain words. The style block positions the button, hides it with opacity and visibility, and shrinks it on phones. The script creates one <button> with the accessible name “Back to top”, adds it to the end of the page, watches the scroll position (once per animation frame, with a passive listener so scrolling stays smooth), and shows the button after 400 pixels. On click it scrolls to the top, smoothly unless the visitor’s device asks for reduced motion, in which case it jumps instantly.

Why one paste instead of CSS in the Custom CSS panel. Squarespace help recommends the Custom CSS panel for styles, and you can move the <style> contents there if you prefer. We kept them together so the button can be removed in one place and so the same block also works on a single page (see below).


Method 2: no JavaScript, for the Basic plan

Squarespace’s custom code guide says that “on all plans, code blocks support plain text, HTML, Markdown, and CSS code surrounded by <style></style> tags”. So a plain link styled as a fixed button works even on Basic. The link points to #top, which browsers treat as the top of the page, and one line of CSS makes the jump smooth.

The trade-off: without JavaScript, hiding the button at the top of the page needs CSS scroll-driven animations. Chromium-based browsers support it and use it; in browsers that do not, the button is simply always visible, which still works. The address bar also shows #top after a click.

Method 2 in Chromium, 22 October 2026: the reveal is pure CSS, and the click is an ordinary link to the top of the page.

Open any page in the editor, scroll to the bottom and click Edit Site Footer. The footer is shared by your pages, so a block added here appears wherever the footer does. Putting the code in a normal page section would show the button only on that page.

Hover the footer and click Edit Site Footer. The round arrow in the corner is the button from the original version of this guide. Screenshot from the Squarespace editor.

Step 2: Add a Code Block

Click Add Block (or the + in a classic editor section), type “code” in the search box and choose Code. Place the block anywhere in the footer; the button is fixed to the corner of the screen, so the block itself shows nothing.

Search the block menu for “code” and pick Code. Screenshot from the Squarespace editor.

Step 3: Paste the code with Mode set to HTML

Open the block’s editor, check Mode is set to HTML and Display Source is off, delete the sample text, and paste:

The line most tutorials miss. #footer-sections { z-index: 9; } is there because Squarespace gives the footer its own layer (in our test it had position: relative and z-index: 0). Without the line, a fixed button inside the footer sat underneath the page content: on the template demo a product’s quick view button covered it and clicks never reached it. The value 9 lifts the footer above page content while keeping it below the header’s value of 10 on that template, so menus still open over it.

Step 4: Save and check another page

Click Save and exit the editor, then open a different page in a logged-out window. The button should be in the bottom right corner (hidden at the very top in Chrome and Edge, always visible in browsers without scroll-driven animations), and a click should return to the top.


Show the button on one page only

If only one long page needs it, a single blog post or a long sales page, use page-level code injection instead of the site-wide Footer field. This needs the same Core, Plus or Advanced plan as Method 1.

  1. Open the page’s settings. Squarespace’s code injection guide says to hover over the page in the Pages panel, click the settings icon and click Advanced.
  2. Paste the Method 1 code into Page Header Code Injection. The script waits for the page to finish loading before it adds the button, so it works from the header. Squarespace advises against putting HTML in that field because it disappears if you turn off the header’s transparency; this code contains only a style block and a script, and the script creates the button itself.
  3. Save and check that page logged out. Other pages stay unchanged.
  4. For one blog post, blog page settings also have a “Post Blog Item Code Injection” field, which Squarespace says applies to every post in that blog, not just one.

Method 3: Back to Top by Elfsight

Back to Top by Elfsight is a hosted widget: you design the button in Elfsight’s online editor and paste one embed code into Squarespace. Its Squarespell listing shows a free Lite plan and paid plans at $5, $10 and $20 a month, and describes floating and embedded modes, a scroll percentage that triggers the button, adjustable scroll speed, spacing controls so it does not overlap other floating elements, and display rules to show or hide it on chosen URLs.

The Elfsight listing on Squarespell, captured 22 October 2026: button styles in the gallery and the four plans on the right.
Elfsight’s own product images, from its listing: corner, edge tab and circle placements.

How to set it up

  1. Open the widget from its listing. Use the Buy from Elfsight button on the listing; it opens Elfsight’s site, where you sign up and start the Back to Top widget.
  2. Choose a style and set the trigger. Pick a button design, its corner or edge, and the scroll percentage after which it appears, as the listing describes.
  3. Add display rules if you need them. The listing says you can show it across the site or hide it on selected URLs.
  4. Copy the installation code. Elfsight gives you a short embed code when you publish the widget.
  5. Paste it into Squarespace. For a floating button on every page, paste it into Code Injection, Footer (Step 1 and Step 2 of Method 1 show where). For one page, paste it into a Code Block on that page with Mode set to HTML.
  6. Save and check it logged out. Elfsight widgets load from Elfsight’s servers, so give the page a few seconds the first time.

A plan note on the listing. Elfsight’s answers on the listing say Business and Commerce plans allow standard custom code embedding and that on Basic the widget can be added with a Markdown block. Business and Commerce are older Squarespace plan names; under the current plans, Squarespace’s own guide says embedding scripts needs Core, Plus or Advanced. We did not test the Markdown block route.


Method 4: Back to Top Button by Common Ninja

Back to Top Button by Common Ninja works the same way: you build it on Common Ninja’s site and paste a short embed code. The listing describes several skins, colour, text and hover colour controls, font changes, a choice of arrow icons and layouts, custom CSS, and a responsive design that adjusts to the screen. It has a free plan; Common Ninja sets the limits and prices on its own site, and the listing deliberately does not repeat them.

The Common Ninja listing on Squarespell, captured 22 October 2026. Squarespell’s own testing status is “Listing checked”.
Common Ninja’s own product image of its editor: font and colour settings for the button. From the listing gallery.

How to set it up

  1. Start from the listing. Use Buy from Common Ninja on the listing to open the widget on Common Ninja’s site.
  2. Pick a skin and customise it. Change colours, font, icon and layout in the dashboard; the listing says no coding is needed.
  3. Copy the embed code. The listing’s answer says Common Ninja gives you “a short piece of embed code” once the widget is set up.
  4. Paste it where the button should load. Code Injection, Footer for every page, or a Code Block set to HTML on one page.
  5. Save and check logged out. The listing says the embedded widget updates automatically when you change it in the dashboard, so you do not paste again after edits.
Several of the skins Common Ninja offers, from its own product images on the listing.

Before you pick a widget for a single arrow. Both widgets add a script from another company’s servers to every page, and free plans of hosted widgets usually carry limits or branding set by the vendor. Check those on the vendor’s pricing page before you commit, because neither listing states them.


Free code or a widget: the comparison

Free code (Methods 1 and 2)ElfsightCommon Ninja
CostFreeFree Lite plan; $5 to $20 a month for paid plansFree plan; paid plans on its site
EditingChange values in the codeVisual editorDrag-and-drop dashboard
Loads fromYour own pageElfsight’s serversCommon Ninja’s servers
Hide until scrolledYes, after 400 px (Method 2: Chromium browsers)Yes, by scroll percentageNot stated on the listing
Page rulesFooter for all pages, or page code injection for oneShow or hide by URLNot stated on the listing
Reduced motion respectedYes, testedNot stated on the listingNot stated on the listing
Tested by usYes, 22 October 2026NoNo

Widget features from each Squarespell listing, checked 22 October 2026. “Not stated” means the listing does not say, not that the feature is missing.


Change the colour, size, position and label

Every change below is a value inside the code you pasted. In Method 2, the class is .sstt-link instead of .sstt-btn; the values are the same.

Colour. Change background: #111111; to your brand colour and color: #ffffff; to the arrow colour. Keep strong contrast so the arrow stays visible; the hover colour is the second background value.

Size. Change width and height (48px on desktop, 44px in the mobile block). Keep at least 44 pixels on phones so it is easy to tap.

Bottom left instead of bottom right. Replace right: 24px; with left: 24px; in the main rule, and right: 16px; with left: 16px; in the mobile rule. Moving it left is the simplest fix when a chat bubble or cookie banner already uses the right corner.

When it appears. In Method 1, change var SHOW_AFTER = 400; (pixels). In Method 2, change animation-range: 0 400px.

A text label instead of an arrow. For a pill that reads “Top”, add this inside the style block, after the other rules:

CSS2 lines
.sstt-btn { width: auto; padding: 0 18px; border-radius: 24px; gap: 6px; font: 600 14px/1 inherit; }
.sstt-btn::after { content: "Top"; }

Hide it on phones. Add .sstt-btn { display: none; } inside the @media (max-width: 767px) block. Many sites want it most on phones, so try it before you remove it.

The default button in its hover state at 1280 pixels wide: 48 pixels round, 24 pixels from the corner. Test page rendered in Chromium, 22 October 2026.

A back to top button solves one direction. Two related widgets on Squarespell cover the others: Scroll Progress by Common Ninja shows how far down the page the reader is, as a bar or a floating circle, and Scroll to Element Button lets visitors jump to a chosen section, such as pricing or a menu. Both have free plans and install with an embed code in the same way as Method 4.

The Scroll Progress listing, captured 22 October 2026. Its “Creator says” line notes Common Ninja lists Squarespace, but not specifically for this widget.
The Scroll to Element Button listing, captured 22 October 2026: the same kind of floating button, pointed at a section instead of the top.

Troubleshooting

I can’t see the button while logged in. Squarespace says that code “sometimes doesn’t appear while you’re logged in, even when visitors can view it”. Check in a private window.

The button is there but something covers it, or clicks do nothing. Another fixed element is on top: a chat bubble, a cookie banner, Squarespace’s mobile information bar, or on template demos the “Free trial” pill. Move the button with the bottom value (try 90px) or to the left corner. For Method 2, check the #footer-sections line is in your code.

The button scrolls away with the page instead of staying in the corner. A fixed element inside a block that has a CSS transform behaves as if it were not fixed. This can affect Method 2, because its link lives inside a Code Block; block animations are the usual cause. Turn off animations on that footer block or switch to Method 1, which attaches the button to the page itself.

The page jumps instead of scrolling smoothly. Your device probably has reduced motion switched on (on a Mac: System Settings, Accessibility, Display, Reduce motion), and the code respects that on purpose. Test with the setting off.

The reveal does not work in Method 2. Your browser does not support scroll-driven CSS yet, so the button is always visible; that is the designed fallback. If it must hide at the top in every browser, you need Method 1 and a plan with JavaScript.

Code Injection or the Code Block says Upgrade. Your plan does not include JavaScript. Use Method 2, or upgrade to Core, Plus or Advanced.

Two buttons appear. You pasted the code in two places (for example the Footer field and a page header), or an older version of this guide’s code is still on the site. Search Code Injection, your footer and Custom CSS for sqs-scroll-to-top or sstt and keep one copy.


What we couldn’t verify

Publishing the gaps is part of the method, not an afterthought.

We didn’t install the code on a live Squarespace site we own. We injected both methods into the live alameda-demo.squarespace.com template (Squarespace 7.1) with Playwright, in Chromium 141, on 22 October 2026, with every request other than page loads blocked, and checked hiding, revealing, clicking, keyboard use, reduced motion and the 390 pixel layout. The demo’s images could not load from our checking environment, so the GIFs were recorded on a local test page instead.

We only tested Chromium. Safari and Firefox were not tested. Method 1 uses standard scrolling and focus methods; Method 2’s reveal relies on scroll-driven animations, which not every browser supports, and the fallback is an always-visible button.

The footer fix is based on one template. The footer’s z-index of 0 and the header’s 10 were read from one 7.1 template. Other templates may use other values; if the button hides behind something, see Troubleshooting.

We couldn’t open Elfsight’s or Common Ninja’s own sites. Both were unreachable from our checking environment. What this guide says about the two widgets, including the set-up steps, comes from their Squarespell listings. We did not install either widget or confirm their free plan limits.

How this guide was made. The article was researched and written with AI assistance, then every claim was checked against the sources linked in it and both code methods were run as described above.


Frequently asked questions

Does Squarespace have a built-in back to top button? No. Squarespace 7.1 has no back to top setting in its site styles or blocks, so the button comes from your own code, as in this guide, or from a widget.

Can I add a scroll to top button on the Squarespace Basic plan? Yes, with Method 2. Basic plan Code Blocks accept HTML and CSS, so a fixed link to the top of the page works. What Basic cannot do is run JavaScript, so the button can only hide itself at the top of the page in browsers that support scroll-driven CSS.

Will a back to top button slow my site down? The free code adds about 2 KB to each page and loads nothing from other servers, so the effect is negligible. Hosted widgets load a script from the vendor on every page, which adds a network request.

Does this work on Squarespace 7.0? The Method 1 code itself is plain HTML, CSS and JavaScript and does not depend on 7.1. We only tested 7.1. Squarespace notes that on 7.0, Ajax loading may stop CSS added through code injection from loading correctly, so if the button looks unstyled on a 7.0 site, move the style block into Custom CSS or turn off Ajax loading.

Is the button accessible? Method 1 uses a real button element with the name “Back to top”, a visible focus outline, keyboard support and reduced motion support, and it moves focus to your header after the scroll. Method 2 is a standard link with the same label and focus outline.

Where should the button go on the page? Bottom right is the convention readers expect. Use bottom left if a chat bubble, cart or cookie banner already sits in the right corner, and keep it at least 16 pixels from the edges on phones.

How do I remove it? Delete the code from Code Injection, Footer (Method 1), the footer Code Block (Method 2) or the page’s Header field, then save. Nothing else on the site changes.

Can I use the code on client sites? Yes. The code in this guide is free to use on your own and client sites, with no attribution needed.


Where to start

On Core, Plus or Advanced, paste Method 1 into Code Injection, Footer, save, and check it in a private window: that is the whole job for most sites. On Basic, use Method 2 in a footer Code Block. Choose Elfsight or Common Ninja only if you want their editors or page rules, and read their plan limits first. If you write long posts, our guide to adding a copy button to Squarespace code blocks uses the same Code Injection steps.

Reviewed and last updated 22 October 2026. All prices checked on that date.

Shahzaib Nadeem

Editorial team · Squarespell

Squarespell installs, tests and verifies website plugins, templates and tools, then publishes what the testing shows. Rankings are never influenced by commission.