How to Add a WhatsApp Click-to-Chat Button to Any Website

4 min read By Simple Tech Path

The short answer

A WhatsApp click-to-chat button is just a link. The format is https://wa.me/<number>?text=<message>, where the number has digits only (country code first, no plus sign, spaces or dashes) and the message is URL-encoded. Put that link in an <a> tag, style it as a floating button and you are done.

I use this on the small business sites I build, because many local businesses take bookings and orders by WhatsApp.

https://wa.me/15555550100?text=Hi!%20I%20would%20like%20to%20book%20a%20wash.
  • 15555550100 is a made-up number for my demo. Real numbers must include the country code.
  • text= holds the message the visitor will see pre-filled in the chat.
  • Spaces become %20. If you build the link with JavaScript, encodeURIComponent() does this for you.

When the visitor taps the link on a phone, WhatsApp opens a chat with that number and the message ready to send. On a computer it opens WhatsApp Web or the desktop app, if available.

The code

In my template the link is built from a config file, but you can write it directly in HTML:

<a class="wa" href="https://wa.me/15555550100?text=Hi!%20I%20would%20like%20to%20book%20a%20wash.">
  Chat on WhatsApp
</a>

And the style that makes it float in the corner:

.wa {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #16a34a;
  color: #fff;
  font-weight: 700;
  padding: 14px 20px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}

How it looks

Here it is on my fictional car wash demo, at the bottom right of a phone-sized screen:

Demo car wash page on a narrow screen with a green Chat on WhatsApp button in the bottom corner

What I checked

I generate the link from a config file, so I opened the page in a browser and inspected the result. The button’s address came out exactly as expected, with the number and the encoded message in place. Checking the generated link is quick and catches mistakes such as a missing digit or an unencoded space.

I could not test a real conversation, because the number in my demo is fictional. If you use a real number, send yourself a test message from a phone before you publish.

Common mistakes

  • Writing the number with a plus sign, spaces or dashes. Use digits only.
  • Forgetting the country code. Without it, the link may not open the right chat.
  • Not encoding the message. Spaces and special characters need encoding.
  • Using a number that is not on WhatsApp. The chat will not open as you expect.
  • Covering important content. On small screens, check that the floating button does not hide text or other buttons.

Making the message useful

A good pre-filled message saves the owner a question. For a car wash, “Hi! I would like to book a wash.” is enough. For a clinic, “Hello! I would like to book an appointment.” works. Keep it short and let the visitor edit it before sending.

You can use different messages on different buttons. For example, a button next to a service can include that service’s name in the message.

Accessibility and privacy

Give the button clear text, not just an icon. If someone uses a screen reader, “Chat on WhatsApp” tells them what the button does.

The link takes the visitor out of your site and into WhatsApp. If you have a privacy page, mention that. I cover privacy basics for small business sites in another article.

Variations worth knowing

One button per service. You can add a link next to each service with the service name already in the message, for example “Hi! I would like to book a Full wash.” The owner then knows what the customer wants before replying.

A different message for each page. If a site has several pages, each can use its own pre-filled message.

A plain text link. Besides the floating button, add a normal link in the contact section, such as “Message us on WhatsApp”. Some visitors scroll past floating elements without noticing them.

Placement and design tips

  • Put the button at the bottom right, where thumbs reach easily on a phone.
  • Use the green people already associate with WhatsApp, but keep enough contrast so the text is readable.
  • Keep the label short and clear.
  • Do not make it so big that it hides the content behind it.
  • Test it on a small screen with the page scrolled to the bottom, to make sure the button does not cover the footer text.

Before you publish

  1. Check the link format: digits only, country code first.
  2. Click the button on a phone and confirm the right chat opens.
  3. Read the pre-filled message to be sure it makes sense out of context.
  4. Confirm with the owner that the number is the one they actually monitor.

Frequently asked questions

Do I need the WhatsApp Business API? No. The wa.me link works with a normal WhatsApp or WhatsApp Business account.

Does it work on a computer? Usually it opens WhatsApp Web or the desktop app. Behavior can vary, so test it.

Can I track clicks? Not with the link alone. You would need an analytics tool, which raises privacy questions.

Will the visitor’s number be shared with the website? The link only opens a chat. It does not send the visitor’s number to your site.