A witness is someone who has, who claims to have, or is thought, by someone with authority to compel testimony, to have knowledge relevant to an event or other matter of interest. In law a witness is someone who, either voluntarily or under compulsion, provides testimonial evidence, either oral or written, of what he or she knows or claims to know about the matter before some official authorized to take such testimony.
A percipient witness or eyewitness is one who testifies what they perceived through his or her senses (e.g. seeing, hearing, smelling, touching). That perception might be either with the unaided human sense or with the aid of an instrument, e.g., microscope or stethoscope, or by other scientific means, e.g.,a chemical reagent which changes color in the presence of a particular substance.
A hearsay witness is one who testifies what someone else said or wrote. In most court proceedings there are many limitations on when hearsay evidence is admissible. Such limitations do not apply to grand jury investigations, many administrative proceedings, and may not apply to declarations used in support of an arrest or search warrant. Also some types of statements are not deemed to be hearsay and are not subject to such limitations.
An expert witness is one who allegedly has specialized knowledge relevant to the matter of interest, which knowledge purportedly helps to either make sense of other evidence, including other testimony, documentary evidence or physical evidence (e.g., a fingerprint). An expert witness may or may not also be a percipient witness, as in a doctor or may or may not have treated the victim of an accident or crime.
A reputation witness is one who testifies about the reputation of a person or business entity, when reputation is material to the dispute at issue. They are a person who aids that because of a persons interactions and personality the defendant is guilty/innocent
In law a witness might be compelled to provide testimony in court, before a grand jury, before an administrative tribunal, before a deposition officer, or in a variety of other proceedings (e.g., judgment debtor examination). Sometimes the testimony is provided in public or in a confidential setting (e.g., grand jury or closed court proceeding).
Although informally a witness includes whoever perceived the event, in law, a witness is different from an informant. A confidential informant is someone who claimed to have witnessed an event or have hearsay information, but whose identity is being withheld from at least one party (typically the criminal defendant). The information from the confidential informant may have been used by a police officer or other official acting as a hearsay witness to obtain a search warrant.