---
title: Int
framework: swift
role: symbol
role_heading: Structure
path: swift/int
---

# Int

A signed integer value type.

## Declaration

```swift
@frozen struct Int
```

## Overview

Overview On 32-bit platforms, Int is the same size as Int32, and on 64-bit platforms, Int is the same size as Int64.

## Topics

### Converting Integers

- [init(_:)](swift/int/init(_:)-4ekvl.md)
- [init(exactly:)](swift/int/init(exactly:)-b1dy.md)
- [init(clamping:)](swift/int/init(clamping:).md)
- [init(truncatingIfNeeded:)](swift/int/init(truncatingifneeded:).md)
- [init(bitPattern:)](swift/int/init(bitpattern:)-72037.md)
- [init(exactly:)](swift/int/init(exactly:)-177ax.md)
- [init(truncating:)](swift/int/init(truncating:).md)

### Converting Floating-Point Values

- [init(_:)](swift/int/init(_:)-6gt9z.md)
- [init(_:)](swift/int/init(_:)-8vbwo.md)
- [init(_:)](swift/int/init(_:)-2oscb.md)
- [init(_:)](swift/int/init(_:)-3huv0.md)
- [init(_:)](swift/int/init(_:)-66i0w.md)
- [init(_:)](swift/int/init(_:)-5q6q5.md)

### Converting with No Loss of Precision

- [init(exactly:)](swift/int/init(exactly:)-7yhn6.md)
- [init(exactly:)](swift/int/init(exactly:)-77kq8.md)
- [init(exactly:)](swift/int/init(exactly:)-7qdwf.md)
- [init(exactly:)](swift/int/init(exactly:)-5xh2s.md)
- [init(exactly:)](swift/int/init(exactly:)-5kot1.md)

### Converting Strings

- [init(_:)](swift/int/init(_:)-2hmii.md)
- [init(_:radix:)](swift/int/init(_:radix:).md)

### Creating a Random Integer

- [random(in:)](swift/int/random(in:)-9mjpw.md)
- [random(in:using:)](swift/int/random(in:using:)-4lsb5.md)
- [random(in:)](swift/int/random(in:)-8zzqh.md)
- [random(in:using:)](swift/int/random(in:using:)-3dwv4.md)

### Performing Calculations

- [Integer Operators](swift/integer-operators.md)
- [negate()](swift/int/negate().md)
- [quotientAndRemainder(dividingBy:)](swift/int/quotientandremainder(dividingby:).md)
- [isMultiple(of:)](swift/int/ismultiple(of:).md)

### Performing Calculations with Overflow

- [addingReportingOverflow(_:)](swift/int/addingreportingoverflow(_:).md)
- [subtractingReportingOverflow(_:)](swift/int/subtractingreportingoverflow(_:).md)
- [multipliedReportingOverflow(by:)](swift/int/multipliedreportingoverflow(by:).md)
- [dividedReportingOverflow(by:)](swift/int/dividedreportingoverflow(by:).md)
- [remainderReportingOverflow(dividingBy:)](swift/int/remainderreportingoverflow(dividingby:).md)

### Performing Double-Width Calculations

- [multipliedFullWidth(by:)](swift/int/multipliedfullwidth(by:).md)
- [dividingFullWidth(_:)](swift/int/dividingfullwidth(_:).md)

### Finding the Sign and Magnitude

- [magnitude](swift/int/magnitude-swift.property.md)
- [Int.Magnitude](swift/int/magnitude-swift.typealias.md)
- [abs(_:)](swift/abs(_:).md)
- [signum()](swift/int/signum().md)

### Accessing Numeric Constants

- [zero](swift/int/zero.md)
- [min](swift/int/min.md)
- [max](swift/int/max.md)
- [isSigned](swift/int/issigned.md)

### Working with Byte Order

- [byteSwapped](swift/int/byteswapped.md)
- [littleEndian](swift/int/littleendian.md)
- [bigEndian](swift/int/bigendian.md)
- [init(littleEndian:)](swift/int/init(littleendian:).md)
- [init(bigEndian:)](swift/int/init(bigendian:).md)

### Working with Binary Representation

- [bitWidth](swift/int/bitwidth.md)
- [bitWidth](swift/int/bitwidth-swift.property.md)
- [nonzeroBitCount](swift/int/nonzerobitcount.md)
- [leadingZeroBitCount](swift/int/leadingzerobitcount.md)
- [trailingZeroBitCount](swift/int/trailingzerobitcount.md)
- [words](swift/int/words-swift.property.md)
- [Int.Words](swift/int/words-swift.struct.md)

### Working with Memory Addresses

- [init(bitPattern:)](swift/int/init(bitpattern:)-2i0qy.md)
- [init(bitPattern:)](swift/int/init(bitpattern:)-2o9co.md)
- [init(bitPattern:)](swift/int/init(bitpattern:)-5qm7a.md)

### Encoding and Decoding Values

- [encode(to:)](swift/int/encode(to:).md)
- [init(from:)](swift/int/init(from:).md)

### Describing an Integer

- [description](swift/int/description.md)
- [hash(into:)](swift/int/hash(into:).md)
- [customMirror](swift/int/custommirror.md)

### Infrequently Used Functionality

- [init()](swift/int/init().md)
- [init(integerLiteral:)](swift/int/init(integerliteral:).md)
- [Int.IntegerLiteralType](swift/int/integerliteraltype.md)
- [distance(to:)](swift/int/distance(to:).md)
- [advanced(by:)](swift/int/advanced(by:).md)
- [Int.Stride](swift/int/stride.md)
- [hashValue](swift/int/hashvalue.md)

### Deprecated

- [customPlaygroundQuickLook](swift/int/customplaygroundquicklook.md)
- [init(_:)](swift/int/init(_:)-3mb3q.md)

### SIMD-Supporting Types

- [Int.SIMDMaskScalar](swift/int/simdmaskscalar.md)
- [Int.SIMD2Storage](swift/int/simd2storage.md)
- [Int.SIMD4Storage](swift/int/simd4storage.md)
- [Int.SIMD8Storage](swift/int/simd8storage.md)
- [Int.SIMD16Storage](swift/int/simd16storage.md)
- [Int.SIMD32Storage](swift/int/simd32storage.md)
- [Int.SIMD64Storage](swift/int/simd64storage.md)

### Operators

- [!=(_:_:)](swift/int/!=(_:_:).md)
- [&>>=(_:_:)](swift/int/&__=(_:_:)-2i06i.md)
- [&<<=(_:_:)](swift/int/&__=(_:_:)-58orm.md)
- [<(_:_:)](swift/int/_(_:_:)-3wpum.md)
- [^=(_:_:)](swift/int/_=(_:_:)-1ypi9.md)
- [%=(_:_:)](swift/int/_=(_:_:)-30t77.md)
- [|=(_:_:)](swift/int/_=(_:_:)-4b29i.md)

### Type Aliases

- [Int.Specification](swift/int/specification.md)
- [Int.UnwrappedType](swift/int/unwrappedtype.md)
- [Int.ValueType](swift/int/valuetype.md)

### Type Properties

- [defaultResolverSpecification](swift/int/defaultresolverspecification.md)

### Default Implementations

- [AdditiveArithmetic Implementations](swift/int/additivearithmetic-implementations.md)
- [AtomicRepresentable Implementations](swift/int/atomicrepresentable-implementations.md)
- [BinaryInteger Implementations](swift/int/binaryinteger-implementations.md)
- [CodingKeyRepresentable Implementations](swift/int/codingkeyrepresentable-implementations.md)
- [Comparable Implementations](swift/int/comparable-implementations.md)
- [CustomReflectable Implementations](swift/int/customreflectable-implementations.md)
- [Decodable Implementations](swift/int/decodable-implementations.md)
- [Encodable Implementations](swift/int/encodable-implementations.md)
- [Equatable Implementations](swift/int/equatable-implementations.md)
- [ExpressibleByIntegerLiteral Implementations](swift/int/expressiblebyintegerliteral-implementations.md)
- [FixedWidthInteger Implementations](swift/int/fixedwidthinteger-implementations.md)
- [Hashable Implementations](swift/int/hashable-implementations.md)
- [SIMDScalar Implementations](swift/int/simdscalar-implementations.md)
- [SignedInteger Implementations](swift/int/signedinteger-implementations.md)
- [SignedNumeric Implementations](swift/int/signednumeric-implementations.md)
- [Strideable Implementations](swift/int/strideable-implementations.md)

## Relationships

### Conforms To

- [AdditiveArithmetic](swift/additivearithmetic.md)
- [AtomicRepresentable](synchronization/atomicrepresentable.md)
- [BNNSGraph.Builder.SliceIndex](accelerate/bnnsgraph/builder/sliceindex.md)
- [BinaryInteger](swift/binaryinteger.md)
- [BindableData](realitykit/bindabledata.md)
- [BitwiseCopyable](swift/bitwisecopyable.md)
- [CKRecordValueProtocol](cloudkit/ckrecordvalueprotocol.md)
- [CVAttachmentValueRepresentable](corevideo/cvattachmentvaluerepresentable.md)
- [CVarArg](swift/cvararg.md)
- [CodingKeyRepresentable](swift/codingkeyrepresentable.md)
- [Comparable](swift/comparable.md)
- [ConvertibleFromGeneratedContent](foundationmodels/convertiblefromgeneratedcontent.md)
- [ConvertibleToGeneratedContent](foundationmodels/convertibletogeneratedcontent.md)
- [Copyable](swift/copyable.md)
- [CustomReflectable](swift/customreflectable.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [CustomURLRepresentationParameterConvertible](appintents/customurlrepresentationparameterconvertible.md)
- [Decodable](swift/decodable.md)
- [Encodable](swift/encodable.md)
- [EntityIdentifierConvertible](appintents/entityidentifierconvertible.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [ExpressibleByIntegerLiteral](swift/expressiblebyintegerliteral.md)
- [FixedWidthInteger](swift/fixedwidthinteger.md)
- [Generable](foundationmodels/generable.md)
- [Hashable](swift/hashable.md)
- [InstructionsRepresentable](foundationmodels/instructionsrepresentable.md)
- [IntentValueConvertible](appintents/intentvalueconvertible.md)
- [IntentValueExpressing](appintents/intentvalueexpressing.md)
- [LosslessStringConvertible](swift/losslessstringconvertible.md)
- [MLDataValueConvertible](createml/mldatavalueconvertible.md)
- [MLIdentifier](createml/mlidentifier.md)
- [MLTensorRangeExpression](coreml/mltensorrangeexpression.md)
- [MirrorPath](swift/mirrorpath.md)
- [NDArray.RangeExpression](coreai/ndarray/rangeexpression.md)
- [Numeric](swift/numeric.md)
- [Plottable](charts/plottable.md)
- [PrimitivePlottableProtocol](charts/primitiveplottableprotocol.md)
- [PromptRepresentable](foundationmodels/promptrepresentable.md)
- [RangeComparableProperty](appintents/rangecomparableproperty.md)
- [SIMDScalar](swift/simdscalar.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [SignedInteger](swift/signedinteger.md)
- [SignedNumeric](swift/signednumeric.md)
- [Strideable](swift/strideable.md)
- [USDPrim.Attribute.MetadataValue](usdkit/usdprim/attribute/metadatavalue.md)
- [USDPrim.Attribute.Value](usdkit/usdprim/attribute/value.md)
- [USDValueProtocol](usdkit/usdvalueprotocol.md)

## See Also

### Standard Library

- [Double](swift/double.md)
- [String](swift/string.md)
- [Array](swift/array.md)
- [Dictionary](swift/dictionary.md)
- [Swift Standard Library](swift/swift-standard-library.md)
