Build a WhatsApp click-to-chat link with https://wa.me/<number>, using the recipient’s full international-format number without a leading plus sign or formatting marks. To prefill a message, add ?text= followed by the URL-encoded message. The link opens a chat with the text ready; the user still has to send it.
WhatsApp link format
WhatsApp’s documented click-to-chat format is https://wa.me/<number>. Put the recipient’s complete international-format number in the path, omitting the plus sign, leading zeroes as applicable to that international representation, spaces, brackets, and dashes. Do not blindly remove digits from a locally formatted number: first establish the correct international-format number for that recipient. See WhatsApp’s click-to-chat instructions and its iOS linking guidance.
As an Amazon Associate I earn from qualifying purchases.
For example, the number supplied in the examples below is already normalized as 15551234567. A locally formatted number such as +1 (555) 123-4567 should not be copied directly into the URL path.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesAdd a pre-filled message
Append a text query parameter: https://wa.me/<number>?text=<encoded-message>. WhatsApp places the text in the chat’s message field; it is not sent automatically. The user reviews it and chooses whether to send.
#1 Best Overall
If the user should choose the recipient, omit the number and use the message-only form https://wa.me/?text=<encoded-message>. WhatsApp says this opens a recipient-selection flow.
Build the link in JavaScript
Use encodeURIComponent() for the message value only. It encodes dynamic text as a URI component, including reserved characters and non-ASCII text that could otherwise interfere with URL parsing. The protocol, host, path separator, and query syntax stay literal.
Rank #2
function makeWhatsAppLink(phoneNumber, message) {
// Supply phoneNumber in international format, with formatting removed.
const base = `https://wa.me/${phoneNumber}`;
if (message === undefined || message === null || message === "") {
return base;
}
return `${base}?text=${encodeURIComponent(message)}`;
}
console.log(makeWhatsAppLink("15551234567", "Hello! Is this still available?"));
To make a link that lets the user pick the recipient, keep the same component-encoding rule:
Recommended Free Tools
const message = "Hello! Is this still available?";
const link = `https://wa.me/?text=${encodeURIComponent(message)}`;
Do not apply encodeURIComponent() to the complete URL: doing so would encode structural characters such as :, /, ?, and =, rather than leaving a usable URL around the encoded message.
Build the link in Python
Use urllib.parse.quote(message, safe='') to percent-encode the message component. Python’s quote uses UTF-8 by default; quote_plus is intended for form-value encoding and represents spaces as plus signs, so quote is the explicit choice here for component construction. See the Python 3.12.15 urllib.parse documentation.
from urllib.parse import quote
def make_whatsapp_link(phone_number: str, message: str | None = None) -> str:
# Supply phone_number in international format, with formatting removed.
base = f"https://wa.me/{phone_number}"
if not message:
return base
return f"{base}?text={quote(message, safe='')}"
print(make_whatsapp_link("15551234567", "Hello! Is this still available?"))
For Python versions before 3.10, replace str | None with Optional[str] after importing Optional from typing, or omit the annotation. This typing syntax does not affect URL construction.
Rank #4
For a recipient-selection link, encode the message in the same way:
from urllib.parse import quote
message = "Hello! Is this still available?"
link = f"https://wa.me/?text={quote(message, safe='')}
JavaScript and Python encoding compared
| Implementation | Encoder | Role and handling |
|---|---|---|
| JavaScript | encodeURIComponent(message) |
Encodes the dynamic message component, including reserved characters; keep fixed URL syntax outside the encoded value. |
| Python | quote(message, safe='') |
Percent-encodes the dynamic message component using UTF-8 by default; use quote rather than form-oriented quote_plus for explicit component construction. |
Use JavaScript when constructing the link in a browser-side flow, and Python when building it in an application or script. In either language, encode the message value—not the entire URL.
Best Value
Common mistakes and limits
- Passing a formatted phone number: Use the complete international-format number in the form WhatsApp expects, without the plus sign or punctuation. Confirm the correct number representation rather than stripping digits mechanically.
- Appending raw message text: Characters such as spaces,
&,?, and#can affect URL parsing. Encode the message as one component before appending it. - Encoding the whole URL: Leave
https://wa.me/and?text=as URL syntax; encode only the dynamic message value. - Expecting automatic sending: Opening the link prepares the chat and fills the text field; it does not send the message for the user.
- Assuming every number is reachable: WhatsApp says the recipient must have an active WhatsApp account. Click to chat works on phone and WhatsApp Web, and does not require saving the recipient to the address book.
The examples follow WhatsApp’s published URL format and the language documentation; they are not a claim that the snippets were executed against WhatsApp clients.
Business short links
For businesses using the WhatsApp Business app, WhatsApp says the app automatically generates a shareable short link and lets the business set or edit a default message. Anyone with that link can message the business. See WhatsApp’s guidance on creating short links. A basic wa.me URL does not require a third-party link service.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Free tools Windows power users keep installed
One-click scans. No signup required.




