Tipping customs and bill layouts vary by place and service. First decide what amount you intend to tip on—before or after tax, before or after a discount—and whether a service charge or gratuity has already been included.
Then calculate the percentage from that chosen base, round as you prefer, and check the final total. A tip calculator can handle the arithmetic, but it cannot decide the local custom or whether an included charge goes to staff. Read the receipt carefully before adding another tip.
For a group, agree on the method before splitting the bill.