Tip Calculator & Bill Splitter

Tip Calculator & Bill Splitter API

Finance

Work out the tip and split the bill: pick 10 to 25% or a custom tip, choose how many people, tip on the pre-tax amount if you like, and round each share up.

Authentication

Send your API key as a Bearer token in the Authorization header (Authorization: Bearer YOUR_API_KEY), or in an X-API-Key header.

Rate Limit

120 requests per minute

Endpoints

2 endpoints available

Overview

Works out the tip, the total and each person's share of a restaurant bill.

Notes

  • bill is the amount printed on the receipt, tax included.
  • To tip on the amount before tax, give the tax as taxRate (a percentage, such as 13 for HST, which is backed out of the bill) or as taxAmount (the dollar amount on the receipt). Send one, not both. Set tipOnPreTax to false to tip on the whole bill instead.
  • roundUp rounds each person's share up to a whole unit (dollar, euro, pound). It only changes the result when it actually changes the amount. roundedPerPerson and roundedTotal are null otherwise, and effectiveTip then includes the rounding.
  • Money is rounded to the cent. split gives exact shares in whole cents that add up to the total: peopleAtLowerShare people pay lowerShare and peopleAtHigherShare people pay one cent more (higherShare). When the total divides evenly, peopleAtHigherShare is 0.
  • Up to 1,000 people.

Endpoints

POST
https://opentools.ca/api/v1/tools/tip-calculator
Calculate a tip and split the bill

Request Body

Content-Type: application/json

ParameterTypeRequiredDescription
bill
number
Required
Bill amount including tax, above 0.
tipPercent
number
Required
Tip as a percentage, 0 to 1000.
people
number
OptionalNumber of people sharing, 1 to 1,000.Default: 1
taxRate
number
OptionalTax rate in percent, included in the bill. Use instead of taxAmount.
taxAmount
number
OptionalTax in dollars, as printed on the receipt. Use instead of taxRate.
tipOnPreTax
boolean
OptionalWork the tip out on the amount before tax. Only matters when tax is given.Default: true
roundUp
boolean
OptionalRound each share up to a whole unit.Default: false

Response Example

{
  "success": true,
  "bill": 113,
  "people": 2,
  "subtotal": 100,
  "tax": 13,
  "tipBase": 100,
  "tip": 18,
  "total": 131,
  "perPerson": 65.5,
  "tipPerPerson": 9,
  "roundedPerPerson": null,
  "roundedTotal": null,
  "effectiveTip": 18,
  "effectiveTipPercent": 18,
  "split": {
    "lowerShare": 65.5,
    "higherShare": 65.51,
    "peopleAtLowerShare": 2,
    "peopleAtHigherShare": 0
  }
}

Error Codes

400
Bad Request - A field is missing or invalid. The response lists each problem.
401
Unauthorized - Missing or invalid API key
403
Forbidden - The API key is inactive or expired, or the request IP is not allowed
405
Method Not Allowed - This endpoint accepts GET and POST only
429
Too Many Requests - Rate limit exceeded (120 requests per minute per API key)
500
Internal Server Error
GET
https://opentools.ca/api/v1/tools/tip-calculator
Calculate a tip and split the bill. Same fields as the POST body, sent as query parameters.

Query Parameters

ParameterTypeRequiredDescription
bill
number
Required
Bill amount including tax, above 0.
tipPercent
number
Required
Tip as a percentage, 0 to 1000.
people
number
OptionalNumber of people sharing, 1 to 1,000.Default: 1
taxRate
number
OptionalTax rate in percent, included in the bill. Use instead of taxAmount.
taxAmount
number
OptionalTax in dollars, as printed on the receipt. Use instead of taxRate.
tipOnPreTax
boolean
OptionalWork the tip out on the amount before tax. Only matters when tax is given.Default: true
roundUp
boolean
OptionalRound each share up to a whole unit.Default: false

Response Example

{
  "success": true,
  "bill": 113,
  "people": 2,
  "subtotal": 100,
  "tax": 13,
  "tipBase": 100,
  "tip": 18,
  "total": 131,
  "perPerson": 65.5,
  "tipPerPerson": 9,
  "roundedPerPerson": null,
  "roundedTotal": null,
  "effectiveTip": 18,
  "effectiveTipPercent": 18,
  "split": {
    "lowerShare": 65.5,
    "higherShare": 65.51,
    "peopleAtLowerShare": 2,
    "peopleAtHigherShare": 0
  }
}

Error Codes

400
Bad Request - A field is missing or invalid. The response lists each problem.
401
Unauthorized - Missing or invalid API key
403
Forbidden - The API key is inactive or expired, or the request IP is not allowed
405
Method Not Allowed - This endpoint accepts GET and POST only
429
Too Many Requests - Rate limit exceeded (120 requests per minute per API key)
500
Internal Server Error

Code Examples

# Split a bill two ways, tip on the pre-tax amount
curl -X POST https://opentools.ca/api/v1/tools/tip-calculator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "bill": 113,
  "tipPercent": 18,
  "people": 2,
  "taxRate": 13
}'

# The same request as a GET with query parameters
curl "https://opentools.ca/api/v1/tools/tip-calculator?bill=113&tipPercent=18&people=2&taxRate=13" \
  -H "Authorization: Bearer YOUR_API_KEY"

Ready to get started?

Create an API key to start using the Tip Calculator & Bill Splitter API.

Rather use it in your browser? Open the Tip Calculator & Bill Splitter