Navigation

HomeImage ToolsCode ToolsMath ToolsDate ToolsGeneratorsUtilities
Color ToolsText ToolsPDF Tools

Truncate Integers

Keep only the first N digits of each integer, discarding the rest.

Chop integers down to N digits — keep the first few from the left, or the last few from the right, whichever side you need. Useful for shortening long IDs, trimming zero-padded values, or previewing how numbers look after a quick cut. And everything runs in your browser. Nothing gets uploaded.

Frequently Asked Questions

What does "from right" mean?

It keeps the first N leading digits and removes trailing digits. 123456 truncated to 3 digits becomes 123.

What does "from left" mean?

It keeps the last N trailing digits. 123456 truncated to 3 digits from left becomes 456.

What if a number has fewer digits than N?

Numbers shorter than N digits are left unchanged.

Are negative signs preserved?

Yes. The minus sign is kept, and only the digit portion is truncated.

Related Tools