WaBestie

WhatsApp Button Code Generator

Add a “Chat on WhatsApp” button to any website in seconds. Enter your number, an optional prefilled message and your button text, then copy the ready-to-paste HTML. A live preview shows exactly how the button will look.

How to use WhatsApp Button Code Generator

  1. 1 Enter your details Add your WhatsApp number (with country code), button text and an optional prefilled message.
  2. 2 Check the preview See the live button preview update as you type.
  3. 3 Copy the HTML Tap “Copy HTML code” and paste it into your website where you want the button.

Turn a phone number into a working WhatsApp button

A WhatsApp button is one of the fastest ways to let people reach you. Instead of asking visitors to copy your number, save it as a contact, then open WhatsApp and start typing, you give them a single button that opens a chat with you already loaded and, if you want, a message already written. The WhatsApp Button Code Generator builds that button for you. You type in the phone number, add an optional prefilled message, pick a style, and the tool hands you ready-to-paste HTML that works on any website, landing page, or blog.

This is built for people who want the result without touching the underlying link syntax: small business owners, freelancers, Shopify and WordPress site owners, marketers running campaigns, and anyone who has ever wished the “Contact us” section on their page went straight to WhatsApp instead of an email form nobody checks. You do not need to know how wa.me links are structured or how to URL-encode a message. The generator handles the fiddly parts and shows you a live preview so you can see the button before it goes live.

How the WhatsApp button generator actually works

Every WhatsApp button is really a link pointing at WhatsApp’s official click-to-chat endpoint. There are two forms of that link, and both do the same thing: https://wa.me/<number> and https://api.whatsapp.com/send?phone=<number>. When someone taps it, WhatsApp opens a conversation with the number you specified. On a phone it launches the app; on a desktop it opens WhatsApp Web or the desktop client. This behaviour is documented by WhatsApp itself, so the button keeps working whether your visitor is on Android, iPhone, or a laptop.

The number is the part people get wrong most often, so the generator is strict about it. WhatsApp click-to-chat links require the phone number in full international format with no plus sign, no zeros, no spaces, brackets, or dashes. A UK number written locally as 07123 456789 has to become 447123456789. A US number like (415) 555 0132 becomes 14155550132. The tool strips out the formatting characters for you and keeps only the country code and subscriber number, which is exactly what wa.me/447123456789 expects.

If you add a prefilled message, the generator URL-encodes it and appends it as the text parameter, producing something like https://wa.me/447123456789?text=Hi%2C%20I%27d%20like%20a%20quote. URL-encoding is what turns spaces into %20 and punctuation into safe characters so the link does not break halfway through. The message is only a suggestion: it drops into the visitor’s text box and they can edit or delete it before sending, which is normal and expected. Nothing is sent automatically.

Finally, the tool wraps that link in an anchor element styled as a button, gives it a target so it opens in a new tab, and adds rel="noopener" for safety. What you copy is a self-contained snippet: paste it between the tags where you want the button to appear and it renders immediately. Because everything is generated from the values you type, you can tweak the number, the message, or the label and regenerate as many times as you like.

Real situations where a WhatsApp button earns its place

A local plumber or salon can put a “Message us on WhatsApp” button in the header of every page so a customer can ask about availability without picking up the phone. The prefilled text might read “Hi, I’d like to book an appointment,” which saves the customer thinking of an opener and gives you an instantly recognisable enquiry.

An online store can place a button on the product page for pre-sale questions. Shoppers who hesitate over sizing or delivery often will not fill in a contact form, but they will fire off a quick WhatsApp message. A prefilled message that includes the product name, for example “Hi, I have a question about the Canvas Weekender bag,” tells you exactly what they are looking at before they even type.

Freelancers and consultants can add the button to an email signature landing page or a Linktree-style bio so prospects reach them on the channel they actually watch. Event organisers can drop a button into a registration confirmation page so attendees can ask logistics questions in one tap. Support teams can put one in the footer sitewide as a low-friction alternative to a ticket system. In each case the button is doing the same job: removing every step between “I have a question” and “I am now chatting with you on WhatsApp.”

Best practices for a button people actually tap

Write a label that says where the tap leads. “Chat on WhatsApp” or “Message us on WhatsApp” outperforms a bare “Contact” because people trust a button more when they know which app opens. Keep the prefilled message short and human. One friendly sentence works; a scripted paragraph feels like a form and gets deleted.

Use the prefilled text to route enquiries. If the same number handles sales and support, set different messages on different pages (“Hi, I’m interested in a quote” on the pricing page, “Hi, I need help with an order” in the footer) so you can tell at a glance why someone is writing. Make sure the number you use is a real WhatsApp account you monitor, ideally a WhatsApp Business number with your name, hours, and address set, so the chat opens with a recognisable profile rather than a bare number.

On mobile-heavy traffic, give the button enough size and padding to be an easy thumb target, and place it where a hesitating visitor already is: near the price, near the add-to-cart, or fixed in a corner. Test the finished button on both a phone and a desktop before you rely on it, because the link opens the app in one place and WhatsApp Web in the other.

Common mistakes and how to avoid them

The single biggest error is a badly formatted number. Leaving in a leading zero (447 written as 4407), keeping the plus sign inside the link, or forgetting the country code entirely will produce a link that opens WhatsApp to an “invalid number” or “phone number shared via url is invalid” screen. Always use country code plus number with digits only, and let the generator clean the input rather than pasting a number with brackets and spaces straight from a business card.

A second mistake is assuming the prefilled message is locked. It is not. WhatsApp deliberately lets the sender edit it, so never put anything in the text that has to arrive unchanged, such as a coupon code you are tracking word for word. Treat the message as a helpful starter, not a contract.

People also confuse a WhatsApp button with a WhatsApp broadcast or a way to message strangers first. Click-to-chat only opens a conversation the visitor chooses to start; it does not let you message people who have not contacted you, and it does not add anyone to a group. If you need groups, generate an invite link inside WhatsApp itself. Lastly, do not hardcode http:// or drop the https://; the link should always be the full secure URL the generator produces.

Troubleshooting

The button opens WhatsApp but says the number is invalid. The number is almost always the culprit. Re-check that it starts with the country code, has no plus sign, no leading zero, and no spaces or dashes. Test the raw link by pasting wa.me/<yournumber> into a browser; if that fails, the button will too.

Tapping it does nothing on desktop. On a computer the link opens WhatsApp Web or the desktop app, which requires that WhatsApp be linked to a phone. If you are testing on a machine that has never signed in to WhatsApp, you will see the QR login page rather than a chat. That is expected behaviour, not a broken button.

The prefilled message shows odd characters like %20 or a broken emoji. That usually means the text was encoded twice or pasted from a source that added hidden characters. Retype the message directly in the generator and let it do the encoding once. Regenerate and copy the fresh snippet.

The button looks unstyled after pasting. Some site builders strip inline styles or wrap pasted HTML. Paste the snippet into a raw HTML or custom-code block rather than a rich-text editor, and if your theme overrides the styling, adjust the class or inline CSS in the generated code to match your site.

It works on my phone but a customer says it fails. The customer may not have WhatsApp installed, or may be on a device where a different default handler intercepts the link. There is no reliable way to force-install the app from a link, so keep an alternative contact method visible for the small share of visitors who do not use WhatsApp.

Why generate the code here

You could write the anchor tag by hand, but the small details (the exact number format, correct URL-encoding of the message, a safe rel attribute, a preview so you catch mistakes before publishing) are where hand-written buttons go wrong. This generator gets those right every time and gives you a clean snippet you own and can edit. Build it once, paste it, and your WhatsApp chat is one tap away from every visitor.

Key features

Prefilled message support

Add an optional opening message that drops into the visitor's WhatsApp text box, correctly URL-encoded so it never breaks the link.

Automatic number cleanup

Paste a number with spaces, brackets, or a plus sign and the tool strips it to the digits-only international format wa.me links require.

Ready-to-paste HTML

Copy a self-contained styled anchor snippet that renders as a working WhatsApp button on any website, blog, or landing page.

Live button preview

See exactly how the WhatsApp button looks and behaves before you copy the code, so mistakes get caught before they go live.

Why people use it

  • Fewer missed enquiries Visitors reach you on WhatsApp in one tap instead of abandoning a contact form, so more questions actually turn into conversations.
  • No code knowledge needed You never have to learn wa.me syntax or URL-encoding; type the number and message and the correct code is written for you.
  • Works everywhere WhatsApp does The generated button opens the app on phones and WhatsApp Web on desktops using WhatsApp's official click-to-chat link.

Frequently asked questions

How do I add a WhatsApp button to my website?

Enter your number in full international format, add an optional message, copy the generated HTML snippet, and paste it into a raw HTML or custom-code block where you want the button to appear. It renders immediately with no extra setup.

What number format does a WhatsApp button need?

WhatsApp click-to-chat links require the country code plus the number with digits only. No plus sign, no leading zero, no spaces or dashes. For example 447123456789 for a UK number. The generator cleans the input for you.

Can I set a message that is already typed in the chat?

Yes. Whatever you enter as the prefilled message is appended to the link and appears in the visitor's text box when the chat opens. They can edit or delete it before sending, since WhatsApp always lets the sender change the text.

Does the button work on both phones and computers?

Yes. On a phone the link opens the WhatsApp app, and on a desktop it opens WhatsApp Web or the desktop client. The visitor needs WhatsApp installed or signed in for the chat to load.

Do I need WhatsApp Business to use a chat button?

No. A click-to-chat button works with any WhatsApp account. A WhatsApp Business profile is recommended because it shows your name, hours, and details when the chat opens, which looks more trustworthy than a bare number.

Can a WhatsApp button message people first or add them to a group?

No. Click-to-chat only opens a conversation that the visitor chooses to start. It cannot message people who have not contacted you and does not add anyone to a group. Group invites are created separately inside WhatsApp.

Privacy & security

This WhatsApp Button Code Generator runs entirely in your browser. The phone number, message, and label you enter are used only to build the code on your own device and are never uploaded, stored, or sent to any server. Close the tab and nothing is retained.

Sources

Your WhatsApp bestie has more tricks

Message packs, fancy text, symbols, links and QR codes. Every tool runs in your browser, free, no sign-up.

Explore all 389 tools