](../../api/pydantic_extra_types_color/)
      * [ Country  ](../../api/pydantic_extra_types_country/)
      * [ Payment  ](../../api/pydantic_extra_types_payment/)
      * [ Phone Numbers  ](../../api/pydantic_extra_types_phone_numbers/)
      * [ Routing Numbers  ](../../api/pydantic_extra_types_routing_numbers/)
      * [ Coordinate  ](../../api/pydantic_extra_types_coordinate/)
      * [ Mac Address  ](../../api/pydantic_extra_types_mac_address/)
      * [ ISBN  ](../../api/pydantic_extra_types_isbn/)
      * [ Pendulum  ](../../api/pydantic_extra_types_pendulum_dt/)
      * [ Currency  ](../../api/pydantic_extra_types_currency_code/)
      * [ Language  ](../../api/pydantic_extra_types_language_code/)
  * Examples  Examples 
    * [ Secrets  ](../../examples/secrets/)
  * Error Messages  Error Messages 
    * [ Error Handling  ](../../errors/errors/)
    * [ Validation Errors  ](../../errors/validation_errors/)
    * [ Usage Errors  ](../../errors/usage_errors/)
  * Integrations  Integrations 
    * [ Mypy  ](../../integrations/mypy/)
    * [ PyCharm  ](../../integrations/pycharm/)
    * [ Hypothesis  ](../../integrations/hypothesis/)
    * [ Visual Studio Code  ](../../integrations/visual_studio_code/)
    * [ datamodel-code-generator  ](../../integrations/datamodel_code_generator/)
    * [ devtools  ](../../integrations/devtools/)
    * [ Rich  ](../../integrations/rich/)
    * [ Linting  ](../../integrations/linting/)
  * [ Blog  ](https://blog.pydantic.dev/)
  * [ Pydantic People  ](../../pydantic_people/)

Page contents

  * Type conversion 
  * Strict Types 
    * Constrained types 
  * Custom Types 
    * Composing types via Annotated 
      * Adding validation and serialization 
      * Generics 
    * Named type aliases 
      * Named recursive types 
    * Customizing validation with __get_pydantic_core_schema__ 
      * As a method on a custom type 
      * As an annotation 
      * Handling third-party types 
      * Using GetPydanticSchema to reduce boilerplate 
      * Summary 
    * Handling custom generic classes 
      * Generic containers 
    * Access to field name 

#  Types

Where possible Pydantic uses [ standard library types
](../../api/standard_library_types/) to define fields, thus smoothing the
learning curve. For many useful applications, however, no standard library
type exists, so Pydantic implements many commonly used types.

There are also more complex types that can be found in the [ Pydantic Extra
Types ](https://github.com/pydantic/pydantic-extra-types) package.

If no existing type suits your purpose you can also implement your  own
Pydantic-compatible types  with custom properties and validation.

The following sections describe the types supported by Pydantic.

  * [ Standard Library Types ](../../api/standard_library_types/) — types from the Python standard library. 
  * Strict Types  — types that enable you to prevent coercion from compatible types. 
  * Custom Data Types  — create your own custom data types. 
  * [ Field Type Conversions ](../conversion_table/) — strict and lax conversion between different field types. 

##  Type conversion  ¶

During validation, Pydantic can coerce data into expected types.

There are two modes of coercion: strict and lax. See [ Conversion Table
](../conversion_table/) for more details on how Pydantic converts data in both
strict and lax modes.

See [ Strict mode ](../strict_mode/) and  Strict Types  for details on
enabling strict coercion.

##  Strict Types  ¶

Pydantic provides the following strict types:

  * [ ` StrictBool ` ](../../api/types/#pydantic.types.StrictBool)
  * [ ` StrictBytes ` ](../../api/types/#pydantic.types.StrictBytes)
  * [ ` StrictFloat ` ](../../api/types/#pydantic.types.StrictFloat)
  * [ ` StrictInt ` ](../../api/types/#pydantic.types.StrictInt)
  * [ ` StrictStr ` ](../../api/types/#pydantic.types.StrictStr)

These types will only pass validation when the validated value is of the
respective type or is a subtype of th