To truncate something is to shorten it, or cut part of it off. In computer science, the term is often used in reference to data types or variables, such as floating point numbers and strings.

For example, a function may truncate the decimal portion of a floating point number to make it an integer. If the number 3.875 is truncated, it becomes 3. Note that this is different than if the number had been rounded to the nearest integer, which would be 4. Strings may also be truncated, which can be useful if a string exceeds the maximum character limit for a certain application.

Several programming languages use the function trunc() to truncate a variable. PHP uses strlen() to truncate a string to a set limit of characters.

Updated in 2006 by Per C.

quizTest Your Knowledge

Which of the following best describes a passphrase?

It is a string containing multiple words used to authenticate a user.
It is a security question used in two-factor authentication.
It is a numeric combination used to access a device.
It is the combination of a username and password.
Correct! Incorrect!     View the Passphrase definition.
More Quizzes →

The Tech Terms Computer Dictionary

The definition of Truncate on this page is an original definition written by the team. If you would like to reference this page or cite this definition, please use the green citation links above.

The goal of is to explain computer terminology in a way that is easy to understand. We strive for simplicity and accuracy with every definition we publish. If you have feedback about this definition or would like to suggest a new technical term, please contact us.

Sign up for the free TechTerms Newsletter

How often would you like to receive an email?

You can unsubscribe or change your frequency setting at any time using the links available in each email.

Questions? Please contact us.