Bail is money or some form of property that is deposited or pledged to a court, in order to secure the release from custody or jail of a suspect who has been arrested, with the understanding that the suspect will return for their trial and required court appearances. Bail is a mechanism to release suspects from imprisonment pre-trial, while ensuring their return for trial. If the suspect does not return to court, the bail is forfeited, and the suspect may possibly be brought up on charges of the crime of failure to appear. If the suspect returns to make all their required appearances, bail is returned after the trial is concluded. In some cases, bail money may be returned at the end of the trial, if all court appearances are made, regardless of whether the person is found guilty or not guilty of the crime accused.
Bail laws vary from country to country; in the United States, bail practices vary by state. In some countries, granting bail is common. Even in such countries, however, bail may not be offered by some courts under some circumstances; for instance, if the accused is considered likely not to appear for trial regardless of bail. Legislatures may also set out certain crimes to be not bailable, such as those that carry the penalty of capital punishment. Even for lesser crimes, bail will not be granted if it is deemed likely that the accused will flee, tamper with evidence, or commit the same offense before trial. Bail amounts may vary depending on the type and severity of crime the suspect is accused of; practices for determining bail amounts vary.
In 46 out of 50 of the United States, as well as the Philippines, it is legal for a commercial bail bondsman to post bail on behalf of individuals; the bondsman in turn charges a non-refundable fee for this service, often a percentage of the bail. The bail debt is then dischargeable under Bankruptcy Code Section 523. This practice is illegal in the rest of the world. 
People charged with a criminal offence in Canada have a constitutional right to reasonable bail unless there is some compelling reason to deny it. These reasons can be related to the accused's likelihood to skip bail, or to public danger resulting from the accused being at large. In stark contrast to many other jurisdictions granting a constitutional right to bail, in Canada the accused may even be denied bail because the public confidence in the administration of justice may be disturbed by letting the individual, still legally innocent, go free pending the completion of the trial or passing of sentence (Criminal Code, s. 515 (10)(c)). Sureties and deposits can be imposed, but are optional.
Instead of remand, a court in the Czech Republic may decide to accept either
- guaranty of a trustworthy person or association or
- a written word of honor of the charged person or
- surveillance of a probation officer or
- a bail.
Bail can be considered when a charged person is held because of concern of possible escape or of a continuation of criminal activity. Bail cannot be considered where there is a concern of influencing witnesses or otherwise frustrating of the proceedings. Bail is also excluded in case of 31 specified serious crimes (e.g. murder, grievous bodily harm, rape, robbery, public endangerment, etc.) when the person is held due to concern of continuation of criminal activity. Bail may be posted either by the charged person, or with his or her consent, by a third party, but this only after this third party has received a thorough briefing regarding the charges and reasons for custody and possible grounds for the forfeiture of the bail.
After the bail has been posted, the court must again review the grounds for bail, and must decide either to accept or refuse the bail. When accepting the bail, the court may also require the charged person to stay in the country.
The court may decide to rescind the bail if the charged person
- escapes, is in hiding or fails to report a change of address and thus frustrates the possibility of delivery of summons or other documents from the court, the prosecution or the police, or
- is at fault for failing to appear for a proceeding, which may not take part without him or her, or
- continues criminal activity, or attempts to finish the crime which he or she had attempted or threatened previously, or
- is evading execution of imprisonment sentence, court ordered fine or other court ordered punishment.
The court holds out on bail as long as the reasons for custody remain (which includes pending of the charges), and in case of conviction until the convict starts serving prison sentence, reimburses the criminal proceedings and/or pays court ordered fine. In case that the court decided also on damages and the aggrieved party asks for it within three months, the bail or its part may be used also to reimburse the damages. Otherwise, the court returns the bail.
Both the prosecutor and the person in custody may challenge any decision on custody (including bail) by filing a complaint which leads to review by an appellate court.
England and Wales
In medieval England, the sheriffs originally possessed the sovereign authority to release or hold suspected criminals. Some sheriffs would exploit the bail for their own gain. The Statute of Westminster (1275) limited the discretion of sheriffs with respect to the bail. Although sheriffs still had the authority to fix the amount of bail required, the statute stipulates which crimes are bailable and which are not.
In the early 17th century, King Charles I ordered noblemen to issue him loans. Those who refused were imprisoned. Five of the prisoners filed a habeas corpus petition arguing that they should not be held indefinitely without trial or bail. In the Petition of Right (1628) Parliament argued that the King had flouted Magna Carta by imprisoning people without just cause.
The Habeas Corpus Act 1679 states, "A Magistrate shall discharge prisoners from their Imprisonment taking their Recognizance, with one or more Surety or Sureties, in any Sum according to the Magistrate's discretion, unless it shall appear that the Party is committed for such Matter or offences for which by law the Prisoner is not bailable." The English Bill of Rights (1689) states that "excessive bail hath been required of persons committed in criminal cases, to elude the benefit of the laws made for the liberty of the subjects. Excessive bail ought not to be required." This was a precursor of the Eighth Amendment to the US Constitution.
In 1976, the Bail Act was enacted with the aims of creating more conditions by which defendants could be denied bail and also redefining the parameters of fulfilling bail. The legislation outlined that courts were obliged to offer bail to defendants unless a specific exception was met. The first of two known exceptions was that the defendant would not willingly surrender and tamper with case evidence; the second was that insufficient case evidence had been collected to allow a defendant to be granted bail. The act also nullified the recognizance system, removing the requirement of paying a specific amount of money and instead arresting defendants for failing to surrender. Many historians have observed a dilemma in which the 1976 Bail Act granted greater power to the courts in handling custody but also pushed them to not put defendants in custody unnecessarily. Legal commentator Susanne Bell notes that the act failed to incur universal legal promotion, instead only allowing defendants to be provided legal aid after they have been reprimanded. Bell believes that this, among other minor flaws, flawed the legislation, but it was nonetheless a springboard for other practical applications.
As a partial amendment to the 1976 Bail Act, the 2003 Criminal Justice Act ruled that bail must be defined to defendants who tested positive for Class A drugs outlined in the Misuse of Drugs Act.
In England and Wales there are three types of bail that can be given: 
- Police bail where a suspect is released without being charged but must return to the police station at a given time.
- Police to court where, having been charged, a suspect is given bail but must attend his first court hearing at the date and Court given
- Court bail , where having already been in court, a suspect is granted bail pending further investigation or while the case continues
By police before charge
Under the Police and Criminal Evidence Act 1984, a police officer of inspector rank or higher has power to release a person who has not been charged on bail. This is deemed to be a release on bail in accordance with sections 3, 3A, 5 and 5A of the Bail Act 1976.  (Before the Policing and Crime Act 2017 came into force, the arresting officer had this power, but now a suspect must normally be released without bail or charged.) This so-called "police bail" lasts 28 days (or 3 months in Serious Fraud Office cases), after which the suspect is required to report to a specified police station, where he may be charged or released. (Before the above-mentioned 2017 Act, the police had the power to extend bail for 28 days at a time arbitrarily many times, leading to some cases of people effectively being punished by restriction of liberty without due process for over a year before their case was dropped.)
If he is released after bail, an extended period of bail may only be imposed once by a superintendent officer up to 3 months (except in SFO cases). In "exceptionally complex" cases, particularly those involving the Financial Conduct Authority or Serious Fraud Office, the period may further be extended by an appropriate decision maker (an officer of the FCA or SFO, if applicable, or otherwise a police commander or assistant chief constable) up to 6 months, subject to representations from the suspect. After that, further extensions of bail, up to 6 months at a time, require a warrant to be issued by a magistrates' court. The bail period is suspended for any day when the suspect is in hospital as an in-patient.
Police bail may be subject to conditions for the following purposes:
- to secure that the person surrenders to custody,
- to secure that the person does not commit an offence while on bail,
- to secure that the person does not interfere with witnesses or otherwise obstruct the course of justice, whether in relation to himself or any other person, or
- for the person's own protection or, if the person is under the age of 18, for the person's own welfare or in the person's own interests. 
However, they may not require a recognizance, surety or security (i.e. money either paid on release or promised, perhaps by a third party, in the event of breaching the other conditions or absconding), or require residence in a bail hostel. 
By police after charge
After a person has been charged, he must ordinarily be released, on bail or without bail.  Exceptions to this include:
- Difficulty to ascertain a real name or address.
- Reasonable grounds for believing that the person arrested will fail to appear in court to answer to bail.
- In the case of a person arrested for an imprisonable offence, the custody officer has reasonable grounds for believing that the detention of the person arrested is necessary to prevent him from committing an offence.
- In the case of a person arrested for an offence which is not an imprisonable offence, the custody officer has reasonable grounds for believing that the detention of the person arrested is necessary to prevent him from causing physical injury to any other person or from causing loss of or damage to property.
- The custody officer has reasonable grounds for believing that the detention of the person arrested is necessary to prevent him from interfering with the administration of justice or with the investigation of offences or of a particular offence.
- The custody officer has reasonable grounds for believing that the detention of the person arrested is necessary for his own protection. But in the case of an arrested juvenile the exceptions include circumstances where: the custody officer has reasonable grounds for believing that he ought to be detained in his own interests.
- the offence with which the person is charged is murder or treason. 
By a court
Any person accused of committing a crime is presumed innocent until proven guilty in a court of law. Therefore, a person charged with a crime should not be denied freedom unless there is a good reason.
The main reasons for refusing bail are that the defendant is accused of an imprisonable offence and there are substantial grounds for believing that the defendant would:
The court should take into account the:
- Nature and seriousness of the offence or default (and the probable method of dealing with the defendant for it)
- Character, antecedents, associations and community ties of the defendant,
- Defendant's bail record, and
- Strength of the evidence 
The court may also refuse bail:
- For the defendant's own protection
- Where the defendant is already serving a custodial sentence for another offence
- Where the court is satisfied that it has not been practicable to obtain sufficient information
- Where the defendant has already absconded in the present proceedings
- Where the defendant has been convicted but the court is awaiting a pre-sentence report, other report or inquiry and it would be impracticable to complete the inquiries or make the report without keeping the defendant in custody
- Where the defendant is charged with a non-imprisonable offence, has already been released on bail for the offence with which he is now accused, and has been arrested for absconding or breaching bail 
Where the accused has previous convictions for certain homicide or sexual offences, the burden of proof is on the defendant to rebut a presumption against bail. 
The Criminal Justice Act 2003 amended the Bail Act 1976 restricting the right to bail for adults who tested positive for a Class A drug and refused to be assessed or refused to participate in recommended treatment. 
Where a defendant is charged with treason, bail may only be granted by a High Court judge or by the Secretary of State.  Section 115 of the Coroners and Justice Act 2009 prohibits magistrates' courts from granting bail in murder cases. 
Conditions may be applied to the grant of bail, such as living at a particular address or having someone act as surety, if the court considers that this is necessary :
- To prevent the defendant absconding
- To prevent the defendant committing further offences while on bail
- To prevent the defendant interfering with witnesses
- For the defendant's own protection (or if he is a child or young person, for his own welfare or in his own interests) 
Failure to comply
Failing to attend court on time as required is an offence, for which the maximum sentence in a magistrates' court is three months' imprisonment, or twelve months in the Crown Court.  (Sentences are usually much shorter than the maximum, but are often custody.) In addition to imposing punishment for this offence, courts will often revoke bail as they may not trust the defendant again. The amended Consolidated Criminal Practice Direction states (at paragraph 1.13.5) that "the sentence for the breach of bail should usually be custodial and consecutive to any other custodial sentence". 
Failing to comply with bail conditions is not an offence, but may lead to the defendant being arrested and brought back to court, where they will be remanded into custody unless the court is satisfied that they will comply with their conditions in future.
Indian law stresses the principles of presumption of innocence. The principle embodies freedom from arbitrary detention and serves as a bulwark against punishment before conviction. More importantly, it prevents the State from successfully employing its vast resources to cause greater damage to an un-convicted accused than he/she can inflict on society. While considering bail applications of the accused, courts are required to balance considerations of personal liberty with public interest.  The Supreme Court has laid down in its judgements, ""Personal liberty, deprived when bail is refused, is too precious a value of our constitutional system recognized under Article 21 that the crucial power to negate it is a great trust exercisable, not casually but judicially, with lively concern for the cost to the individual and community. To glamorize impressionistic orders as discretionary may, on occasions, make a litigative gamble decisive of a fundamental right. After all, personal liberty of an accused or convict is fundamental, suffering lawful eclipse only in terms of procedure established by law." The courts have also held that foreign nationals cannot be deprived of the right to seek bail. The Delhi High Court observed, "Law does not permit any differentiation between Indian Nationals and Foreign citizens in the matter of granting bail. What is permissible is that, considering the facts and circumstances of each case, the court can impose different conditions which are necessary to ensure that the accused will be available for facing the trial. It cannot be said that an accused will not be granted bail because he is a foreign national." 
The Code of Criminal Procedure, 1973 does not define bail, although the terms bailable offence and non-bailable offence have been defined in section 2(a) of the Code. A Bailable offence is defined as an offence which is shown as bailable in the First Schedule of the Code or which is made bailable by any other law, and non-bailable offence means any other offence. Further, Sections 436 to 450 set out the provisions for the grant of bail and bonds in criminal cases. The amount of security that is to be paid by the accused to secure his release has not been mentioned in the Code. Thus, it is left to the discretion of the court to put a monetary cap on the bond. The Supreme Court of India has delivered several cases wherein it has reiterated that the basic rule is - bail and not jail. One such instance came in State Of Rajasthan, Jaipur v. Balchand @ Baliay which the Supreme Court decided on 20 September 1977, and held that the basic rule is bail, not jail, except where there are circumstances suggestive of fleeing from justice or thwarting the course of justice or creating other troubles in the shape of repeating offences or intimidating witnesses and the like by the petitioner who seeks enlargement on bail from the court. The bench of Krishnaiyer, V.R. had observed that when considering the question of bail, the gravity of the offence involved and the heinousness of the crime which are likely to induce the petitioner to avoid the course of justice must weigh with the court. Taking into consideration the facts of the case the apex court held that the circumstances and the social milieu do not militate against the petitioner being granted bail.
When a person accused of a crime is arrested, his statement is recorded and information such as the name, residence address, birthplace, charges filed are noted. The police officer may also check back the criminal record if any in the police station and ask for fingerprints to file a case against the accused. Under the Code of Criminal Procedure 1973 (First Schedule), offences have been classified as "bailable" and "non-bailable" offences. In the case of bailable offences, if the accused produces proper surety, and fulfills other conditions, it is binding upon the Investigating officer to grant bail. However, in case of a non-bailable offence, the police cannot grant bail; it can only be granted by a Judicial Magistrate/Judge. The Investigating Officer must produce the accused before the Judicial Magistrate / Judge concerned within 24 hours of his arrest. At that time, the accused has a right to apply for bail. Depending upon the facts of the case, the judge decides whether bail should be granted. If bail is granted the accused must deposit money with the court. Generally, for lesser crimes, a standard amount is asked to be deposited for awarding the bail.
There are some conditions put under section 437 of the Cr.P.C. wherein bail can be requested even for non-bailable offense. In non-bailable cases, bail is not the right of the accused, but the discretion of the judge if regards the case as fit for the grant of bail, it regards imposition of certain conditions as necessary in the circumstances. Section 437(3) elaborates the conditions set by the law to get bail in non-bailable offenses. The sub-section says that when a person accused or suspected of the commission of an offense punishable with imprisonment which may extend to seven years or more or of an offense under Chapter VI, Chapter XVI or Chapter XVII of the Indian Penal Code (45 of 1860) or abatement of, or conspiracy or attempt to commit, any such offense, is released on bail under sub-section (1). However, for that the Court has power to impose any condition which it considers necessary. Some conditions that the court may place while granting bail are to ensure that such person shall attend in accordance with the conditions of the bond executed under this Chapter, or to ensure that such person shall not commit an offence similar to the offence of which he is accused or of the commission of which he is suspected, or otherwise in the interests of justice.
Bail can be granted by any of courts of Scotland, with the final decision in solemn proceedings being with the High Court of Justiciary. All crimes are bailable, and bail should be granted to any accused person "except where there is good reason for refusing bail." The Bail, Judicial Appointments etc. (Scotland) Act 2000, an Act of the Scottish Parliament, had removed the previous restrictions on bail that meant that murder and treason were not ordinarily bailable.  However, a person could be bailed when accused of these of crimes on application of the Lord Advocate or by a decision of the High Court itself. The Criminal Proceedings etc. (Reform) (Scotland) Act 2007 did reintroduce restrictions on the granting of bail by requiring exceptional circumstances to be shown when a person is accused of a violent, sexual, drugs offence, and they have a prior conviction for a similar offence. 
In Scotland, the focus is normally for those who are opposed to bail to convince the courts that bail should not be granted. With the procurator fiscal given guidance to use the nature and gravity of an offence as grounds to oppose bail. 
A person who is refused bail can appeal against the refusal to either the Sheriff Appeal Court for summary proceedings in the Sheriff Courts and Justice of the Peace Courts and solemn proceedings in the Sheriff Courts, or to the High Court of Justiciary when a case is on trial there.   The High Court of Justiciary has final authority to decide all bail decisions, and will decide on bail appeals for cases before the High Court on first instance. A Procurator Fiscal or Advocate Depute can request the High Court to review any bail decision where they believe that bail should not have been granted.  
In the United States there are several forms of bail used, which vary from jurisdiction. "The dominant forms of release are by surety bond, i.e. release on bail that is lent to the accused by a bond dealer, and non-financial release." : 2 Many states, including California, have a "bail schedule" that lists the recommended bail amount for a given criminal charge. At the first court appearance (the arraignment) the judge can set the bail at the amount listed on the schedule or at a different amount based on the specific facts of the crime and the person accused. 
Bail in the United States has been criticized as being discriminatory and vague in nature.