How to add a comment box to your website

By Guestbook World ·

A laptop on a terracotta table in a bakery, showing its Say hello page with an embedded guestbook and two messages, beside a bowl of bread and a coffee

To add a comment box to your website, you paste a small piece of code from a comment service where the box should appear. A web page on its own cannot keep what visitors type, so the comments have to be saved somewhere else and shown back to the next visitor. Ours is a free guestbook that works as one comment box for your whole site: two lines of HTML, a spam check on every message, and your OK before anything with a link goes up.

Why plain HTML cannot hold comments

An HTML form can collect a name and a message, but a static page has nowhere to put them. The text has to travel to a server that stores it and adds it to the page for everyone who comes later. That is why every comment box you have seen is either built into the platform the site runs on or loaded from a service.

Some free “comment box code” you will find online uses only HTML and JavaScript. It shows the new comment straight away, which looks right, but the comment lives in the writer’s own browser. Nobody else sees it, and it is gone when they clear their browser data or switch devices.

Two kinds of comment box

There are two different things people mean by a comment box, and it helps to know which one you want before you pick a tool.

One box for the whole site. Visitors leave a note about the site, your work or you, and the newest note shows first. This is what a guestbook is, and it suits personal sites, portfolios, small businesses, bands, clubs and fan pages.

A thread under every post. Each article gets its own discussion, and readers reply to that article and to each other. This is what blogs and news sites use.

Our guestbook is the first kind. Blogs that need the second kind are better off with a comment system per post.

Add ours in two lines

  1. Make a free guestbook for your website and pick its address, such as guestbookworld.com/g/your-name.
  2. Open the guestbook’s Share page and copy the embed code:
<div data-guestbookworld="your-name"></div>
<script src="https://guestbookworld.com/embed.js" async></script>
  1. Paste both lines into your page’s HTML where the comment box should appear.
  2. Publish the page and leave the first comment yourself to see it work.

The first line marks the spot, and the second line loads the comment box into it. The box grows to fit the messages, so you do not set a height. The newest 20 messages show first, with an “Older messages” button under them.

If your site does not allow scripts

Some site builders let you paste a frame but not a script. For those, the Share page has a plain frame version:

<iframe src="https://guestbookworld.com/embed/your-name/" title="Guestbook" style="width:100%;height:900px;border:0"></iframe>

A frame keeps the height you give it, so make it taller if the messages get cut off. If your builder takes neither, link to the guestbook’s own page, or add the “Sign my guestbook” badge from the Share page, a small button in a light and a dark version. For where each site builder keeps its code block, see our guide to adding a guestbook to WordPress, Wix and more.

What visitors fill in

Visitors write their name and a message of up to 2,000 characters. You can also ask where they are from and for their website, and both of those stay optional for them. Nobody needs an account or an email address to leave a comment.

Keeping it free of spam

An open comment box on a public site draws spam bots, so these are the settings that matter:

  • A bot check from Cloudflare runs on every message before it is sent.
  • Any message with a link waits for you to read it.
  • Review mode holds every new message until you publish it.
  • Visitors can report a message, and three reports take it down until you look.
  • You can reply under any message, hide it, mark it as spam or delete it.

When you are done collecting comments, you can close the guestbook: the old messages stay up and new ones stop. You can also download every message as a spreadsheet. The full list is on our features page, and all of it is free.

When a comment system per post fits better

If you run a blog and want readers to discuss each post separately, a guestbook is the wrong tool. Use a system built for threads:

  • WordPress has comments built in. According to WordPress’s own documentation, you can hold comments for approval, hold any comment with links in the queue, and turn comments on post by post.
  • giscus and utterances are free and open source and say they have no ads and no tracking. They store comments on GitHub, though, so visitors have to sign in with GitHub to comment. That fits a blog about code and turns most other readers away.
  • Hosted comment services, the widget companies you see in search results, add a thread to every page. Read their plans and their privacy terms before you pick one.

A middle path for a small site: each account can hold up to ten guestbooks, so a few pages can each get their own box. That works for a handful of pages, not for a blog with hundreds of posts.

Where to put the comment box

A contact or about page is the usual spot, because that is where visitors go when they want to say something to you. A page of its own, called Guestbook or Say hello and linked in your menu, works well too. You can also put it at the bottom of your home page, under everything else. The frame only loads when a visitor scrolls near it, so it does not hold up the top of the page.

Quick answers

Is there a free comment box for a website? Yes. Our guestbook is free with every feature, including the spam check, replies and the spreadsheet download.

Can I add a comment box with HTML only? You can paste the HTML, but the comments are saved by a service like ours. Plain HTML with no service behind it cannot store them for other visitors to see.

Does it work on Neocities? Yes, and our Neocities guestbook guide walks through it. The steps from sign-up to the first message are also on how it works.

Is a guestbook the same as a comment section? Close: a guestbook is one comment section for the whole site. Our guide to guestbook or guest book explains where the word comes from and how it is spelled.

Open your guestbook today

It takes a minute, it is free, and the first message could come from anywhere.

Create your guestbook