</> ConvertAtlas Developer Tools
Bootstrap 5 · Intermediate

Phone Number Mask

A phone input formatted to (xxx) xxx-xxxx, via Cleave.js.

Requires Bootstrap 5, Cleave.js. Add the CDN tags below to your page (styles in <head>, scripts before </body>). The downloaded file already includes them.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/cleave.js@1.6.0/dist/cleave.min.js"></script>
<div class="card border-0 shadow-sm" style="max-width:320px"><div class="card-body"><label class="form-label small fw-semibold">Phone</label><input class="form-control" id="clPhone" placeholder="(000) 000-0000"></div></div>
new Cleave('#clPhone',{delimiters:['(',') ','-'],blocks:[0,3,3,4],numericOnly:true});
Free to use.This component uses Bootstrap 5, Cleave.js (linked above). Copy any file, or download a ready-to-open .html page with the CDN links already included.