In differential topology, a smooth submanifold in a manifold has a tubular neighborhood, and in piecewise-linear topology, a subcomplex of a simplicial complex has a regular neighborhood. The purpose of this paper is to develop a similar theory for algebraic and semialgebraic sets. The neighbor- hoods will be defined as level sets of polynomial or semialgebraic functions. Introduction. Let M be an algebraic set in real n-space R", and let X be a compact algebraic subset of M containing its singular locus, if any. An algebraic neighborhood of A' in M is defined to be a_1(0, 8), where o > 0 is sufficiently small and a: M -> R is a proper polynomial function for which a > 0 and a_1(0) = X. Such an a will be called a rug function. Occasionally we will need rational or analytic a, but this is not a significant generalization. Algebraic neighborhoods always exist. The curve selec- tion lemma is used to prove uniqueness ; anyone familiar with (Milnor 2) will recognize the technique. Since uniqueness is a crucial result, and since there are a few trouble- some small points, this proof is given in detail. The uniqueness theorem shows that the "link" of a singularity of an algebraic set M is independent of the embedding of M in its ambient space; I have been unable to find a proof of this result in the litera- ture. In addition, an algebraic neighborhood of a nonsingular X in M is shown to be a tubular neighborhood in the sense of differential topology. This material is in §1. In §2 the theory is rapidly developed for real and complex projective space by embedding these spaces in real affine space. As an application, it is shown that when M is an affine algebraic set with projective completion M, then the complement in M of a large ball centered at the origin of affine space is an alge- braic neighborhood of the intersection of M with the hyperplane at infinity. In §3, the theory is generalized to the case where M is a semialgebraic subset of R" and X is a compact semialgebraic subset of M. (For example, X could be a non- isolated singular point of M.) A semialgebraic neighborhood of X in M is defined to be a-1(0, o), where o > 0 is sufficiently small and a: M -> R is a proper semialgebraic function for which a > 0 and a_1(0) = X. Again these neighborhoods exist and are unique ; this is shown by mimicking the proof in the algebraic case, using semialgebraic